Example #1
0
        private IEnumerator CoAnimationAttack(bool isCritical)
        {
            while (true)
            {
                AttackEndCalled = false;
                if (isCritical)
                {
                    Animator.CriticalAttack();
                }
                else
                {
                    Animator.Attack();
                }

                _forceQuit = false;
                var coroutine = StartCoroutine(CoTimeOut());
                yield return(new WaitUntil(() => AttackEndCalled || _forceQuit));

                StopCoroutine(coroutine);
                if (_forceQuit)
                {
                    continue;
                }

                break;
            }
        }
Example #2
0
 public void animateEnemy()
 {
     if (currentState is FollowState)
     {
         Animator.Walk(target.transform.position - enemy.transform.position);
     }
     else if (currentState is RetreatState)
     {
         Animator.Walk(myStartPosition - enemy.transform.position);
         movement.Direction = Vector2.zero;
         movement.Direction = (myStartPosition - enemy.transform.position).normalized;
     }
     else if (currentState is AttackState)
     {
         Animator.Attack((Target.transform.position - enemy.transform.position).normalized);
         movement.Direction = Vector2.zero;
         movement.Direction = (Target.transform.position - enemy.transform.position).normalized;
     }
     else if (currentState is IdleState)
     {
         Animator.Stay(movement.Direction);
     }
 }