void Update()
 {
     if (!aiActive)
     {
         return;
     }
     currentState.UpdateState(this);
 }
예제 #2
0
    void Update()
    {
        if (!aiActive)
        {
            return;
        }

        currentState.UpdateState(this);

        if (animator != null)
        {
            if (lookingRight && body.velocity.x < 0)
            {
                animator.SetBool("lookingRight", false);
                lookingRight = false;
            }

            if (!lookingRight && body.velocity.x > 0)
            {
                animator.SetBool("lookingRight", true);
                lookingRight = true;
            }
        }
    }