public void ChangeState(State <T> newState)
 {
     if (stateCurrent != null)
     {
         stateCurrent.Exit();
     }
     stateCurrent = newState;
     stateCurrent.Enter();
 }
Esempio n. 2
0
 public void SetState <TState>() where TState : State
 {
     if (_stateAlreadySet)
     {
         return;
     }
     stateEvent?.Raise(currentState.Exit());
     currentState = GetState <TState>();
     stateEvent?.Raise(currentState.Enter());
     _stateAlreadySet = true;
 }