Esempio n. 1
0
    /// <summary>
    /// Changes the current state in the AI State Machine
    /// </summary>
    /// <param name="brainState"></param>
    public virtual void ChangeBrainState(BrainState brainState)
    {
        // perform any exit operations from the previous state
        if (currentBrainState != null)
        {
            currentBrainState.Exit();
        }

        // save the new brain state and enter
        currentBrainState = brainState;
        currentBrainState.Enter(this);
    }