/// <summary>Leaves all currently active game states</summary> private void leaveAllActiveStates() { while (this.activeGameStates.Count > 0) { GameState topMostGameState = this.activeGameStates.Pop(); topMostGameState.InternalLeaving(); } }
/// <summary>Takes the currently active game state from the stack</summary> public void Pop() { GameState topMostGameState = this.activeGameStates.Peek(); topMostGameState.InternalLeaving(); this.activeGameStates.Pop(); if (this.activeGameStates.Count > 0) { try { this.activeGameStates.Peek().InternalResume(); } catch (Exception) { topMostGameState.InternalEntered(); this.activeGameStates.Push(topMostGameState); throw; } } }