Exemple #1
0
    public void SwitchState(AIState newState)
    {
        if (State != null)
        {
            if (State.Type == newState.Type)
            {
                return;
            }

            State.Deactivate();
        }

        State = newState;
        State.Activate();
    }
Exemple #2
0
    public void SetState(AIState state)
    {
        //Deactivate your old state:
        if (currentAIState != null)
        {
            currentAIState.Deactivate();
        }

        //Switch to the new state:
        currentAIState = state;

        //Activate the new state:
        if (currentAIState != null)
        {
            currentAIState.Activate();
        }
    }
    public void SetState(AIState state)
    {
        //Deactivate your old state
        if (m_CurrentAIState != null)
        {
            m_CurrentAIState.Deactivate();
        }

        //switch to the new state
        m_CurrentAIState = state;

        //Activate the new state
        if (m_CurrentAIState != null)
        {
            m_CurrentAIState.Activate();
        }
    }
Exemple #4
0
 public void ChangeState(int state)
 {
     this.currentState  = states[state];
     this._currentIndex = state;
     currentState.Activate();
 }