/// <summary> Appel la fonction Exit() du vieux state et le Enter() du nouveau </summary> /// <param name="newState"> Nouveau state </param> public void ChangeState(IStates newState) { currentState.Exit(); previousState = currentState; currentState = newState; currentState.Enter(); }
public void ChangeState(IStates newState) { if (currentState != null) { currentState.Exit(); } currentState = newState; currentState.Enter(this); }