Ejemplo n.º 1
0
 /// <summary>Leaves all currently active game states</summary>
 private void leaveAllActiveStates()
 {
     while (this.activeGameStates.Count > 0)
     {
         GameState topMostGameState = this.activeGameStates.Pop();
         topMostGameState.InternalLeaving();
     }
 }
Ejemplo n.º 2
0
        /// <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;
                }
            }
        }