Exemplo n.º 1
0
        IEnumerator ChangeState()
        {
            state = DoctorStates.approach;
            animator.Play("Run");

            yield return(Coroutine.WaitForSeconds(1));

            state = DoctorStates.attack;
            animator.Play("Attack2", SpriteAnimator.LoopMode.ClampForever);
        }
Exemplo n.º 2
0
        private void CheckRange()
        {
            float distance = Vector2.Distance(Position, truck.Position);

            if (distance > range)
            {
                state             = DoctorStates.idle;
                approachCoroutine = null;
            }
            else
            {
                if (approachCoroutine == null)
                {
                    approachCoroutine = Core.StartCoroutine(ChangeState());
                }
            }
        }