示例#1
0
    void GetCurrentState()
    {
        AnimatorStateInfo stateInfo = animator.GetCurrentAnimatorStateInfo(0);

        foreach (Behaviors nBehavior in behList)
        {
            if (stateInfo.IsName(nBehavior.animationName))
            {
                int i = (int)stateInfo.normalizedTime;

                if (CurrentBehavior != nBehavior.Behavior)
                {
                    if (stateInfo.normalizedTime >= i + 0f && stateInfo.normalizedTime <= i + 0.1f)
                    {
                        CurrentBehavior = nBehavior.Behavior;
                        break;
                    }
                }
                if (CurrentBehavior == nBehavior.Behavior)
                {
                    break;
                }
            }
        }
    }
示例#2
0
 void ChangingAnimation()
 {
     if (currentBehavior != nextBehavior)
     {
         enemyBehContr.animator.ResetTrigger(FindTriggerAnimation(currentBehavior));
         currentBehavior = nextBehavior;
         enemyBehContr.animator.SetTrigger(FindTriggerAnimation(nextBehavior));
     }
 }
示例#3
0
    string FindTriggerAnimation(EnemyBehaviorList behavior)
    {
        var Behaviors = enemyBehContr.behList;

        foreach (var nBehavior in Behaviors)
        {
            if (nBehavior.Behavior == behavior)
            {
                return(nBehavior.triggerName);
            }
        }

        return("");
    }
示例#4
0
    void GetNexAnimationBehavior()
    {
        AnimatorStateInfo StateInfo = enemyBehContr.animator.GetNextAnimatorStateInfo(0);

        var Behaviors = enemyBehContr.behList;

        foreach (var nBehavior in Behaviors)
        {
            if (StateInfo.IsName(nBehavior.animationName))
            {
                nextBehavior = nBehavior.Behavior;
                break;
            }
        }
    }
示例#5
0
 void GetNextBehavior()
 {
     nextBehavior = enemyBehContr.CurrentBehavior;
 }
示例#6
0
 void Start()
 {
     animator        = GetComponent <Animator> ();
     CurrentBehavior = EnemyBehaviorList.Idle;
 }