Пример #1
0
    public void SetState(AiState state)
    {
        if (currentState != null)
        {
            currentState.OnStateExit();
        }

        currentState = state;

        if (currentState != null)
        {
            currentState.Init();
            currentState.OnStateEnter();
        }
    }
Пример #2
0
 /// <summary>
 /// Send OnStateExit notification to previous state.
 /// </summary>
 private void NotifyOnStateExit()
 {
     previousState.OnStateExit(previousState, currentState);
 }