예제 #1
0
    public void CheckDistance()
    {
        if (!target.GetComponent <Player>().isDead)
        {
            if (Vector3.Distance(target.position, transform.position) <= chaseRadius)
            {
                if (Vector3.Distance(target.position, transform.position) <= attackRadius)
                {
                    //Attack state

                    ChangeAnim(target.position - transform.position);
                    stateMachine.ChangeState(Monk_AttackState.Instance());
                }
                else if (!isCasting)
                {
                    //Chase state
                    stateMachine.ChangeState(Monk_WalkingState.Instance());
                }
            }
            else
            {
                //Idle State
                stateMachine.ChangeState(Monk_IdleState.Instance());
            }
        }
        else
        {
            //If player is dead
            ChangeAnim(Vector2.down);
            StopCoroutine("CastCo");
        }
    }
예제 #2
0
    public static Monk_WalkingState Instance()
    {
        if (_instance == null)
        {
            _instance = new Monk_WalkingState();
        }

        return(_instance);
    }