public void MoveTo(LightSwitchState nextState) { if (nextState.GetType() != _currentState.GetType()) //TODO explain this! { _currentState = nextState; _currentState.OnEnter(this); //what about OnExit()? } }
public LightSwitchStateMachine(LightSwitchState initialState) { _currentState = initialState; _currentState.OnEnter(this); //has to be the last line!!! Alternative - Start() method }
public void MoveTo(LightSwitchState nextState) { _currentState = nextState; _currentState.OnEnter(); //what about OnExit()? }