Unity3d动画有时候不会显示

时间:2016-09-24 20:53:19

标签: unity3d

我有一个简单的弹出文本动画师,附带四个动画(治疗文本动画,暴击治疗动画,伤害动画和暴击伤害瞄准)。

动画师会更改从简单脚本收到的触发器上的动画。

public static void PopUpTextInstantiator(int text, Transform location, bool crit)
{
     Initialize();
     Debug.Log("Instancing POPUP with VALUE" +text +" and CRIT is "+ crit);
     PopUpText instanceclone = Instantiate(popupText);
     Vector2 screenPosition = new Vector2(location.position.x + Random.Range(-.5f, .5f), location.position.y + Random.Range(0.1f, 0.5f));

     instanceclone.transform.SetParent(canvas.transform, false);
     if (text < 0 && crit == true)
     {
         instanceclone.GetComponentInChildren<Animator>().SetTrigger("CritDamage");
         Destroy(instanceclone, 1.2f);
     }
     else if (text < 0 && crit == false)
     {
         instanceclone.GetComponentInChildren<Animator>().SetTrigger("Damage");
         Destroy(instanceclone, 1.2f);
     }
     else if (text > 0 && crit == false)
     {

         instanceclone.GetComponentInChildren<Animator>().SetTrigger("Heal");
         Debug.Log("IM WORKING POPUP INSTANTIATOR NON CRIT");
         Destroy(instanceclone, 1.2f);
     }
     else if (text > 0 && crit == true)
     {
         instanceclone.GetComponentInChildren<Animator>().SetTrigger("CritHeal");
         Destroy(instanceclone, 1.2f);
     }

     //Debug.Log("Instancing POPUP at COORD VALUE" + location.transform.position);
     //instanceclone.transform.position = screenPosition;
     instanceclone.transform.position = screenPosition;
     instanceclone.SetText(text);
 } 

有些问题(并非总是如此)经常会出现动画(尤其是#34; hea动画&#34;)。我看到实例父,但没有动画。构建中的问题相同。暴击治疗动画总是正确显示,有时无法显示伤害,而且简单的治疗并不经常显示。我只是不明白错误的原因和位置 - 脚本基本相同。动画本身就很完美。

0 个答案:

没有答案