Esempio n. 1
0
    public void Change(stateMachine nextState)
    {
        if (currentState == nextState)
        {
            return;
        }
        switch (currentState)
        {
        case stateMachine.Idle:
            m_Idle.Exit(this.gameObject);
            break;

        case stateMachine.Move:
            m_Move.Exit(this.gameObject);
            break;

        case stateMachine.Attack:
            m_Attack.Exit(this.gameObject);
            break;

        case stateMachine.Death:
            m_Death.Exit(this.gameObject);
            break;
        }
        currentState = nextState;
        switch (currentState)
        {
        case stateMachine.Idle:
            m_Idle.Enter(this.gameObject);
            break;

        case stateMachine.Move:
            m_Move.Enter(this.gameObject);
            break;

        case stateMachine.Attack:
            m_Attack.Enter(this.gameObject);
            break;

        case stateMachine.Death:
            m_Death.Enter(this.gameObject);
            break;
        }
    }