Exemplo n.º 1
0
 void Start()
 {
     if (initialState != null)
     {
         currentState = initialState;
         initialState.EnterState();
     }
 }
Exemplo n.º 2
0
    //=========================================================//
    // Declare public methods
    public void EnterState(StateType stateType)
    {
        // First, check the state type is in the dictionary
        if (fsmStates.ContainsKey(stateType))
        {
            // Get the state from the dictionary
            AbstractCatFSMState state = fsmStates[stateType];

            // Exit the current state
            if (currentState != null)
            {
                currentState.ExitState();
            }

            // Set the current state to this state and enter state
            currentState = state;
            currentState.EnterState();
        }
    }