public void ChangeState(IPlaneObjectState newState) { if (this.currentlyRunningState != null) { this.currentlyRunningState.Exit(); } this.previousState = this.currentlyRunningState; this.currentlyRunningState = newState; this.currentlyRunningState.Enter(); }
public void SwitchToPreviousState() { this.currentlyRunningState.Exit(); this.currentlyRunningState = this.previousState; this.currentlyRunningState.Enter(); }