Exemple #1
0
        public SM(Character a_controller, State sInitialState)
        {
            controller = a_controller;

            //uses this function to initalise the first state rather than assigning it
            //so the state machine is passed to the state itself
            ChangeState(sInitialState);
        }
Exemple #2
0
 public void ChangeState(State sNewState)
 {
     if (currentState != null) {
         previousState = currentState;
         currentState.ExitState ();
     }
     currentState = sNewState;
     currentState.EnterState(this);
 }