예제 #1
0
 /// <summary>
 /// Registers a game state with a given type.
 /// </summary>
 /// <param name="type">The type.</param>
 /// <param name="state">The state.</param>
 /// <returns></returns>
 public bool RegisterState(GameStateType type, GameState state)
 {
     if (stateTypes.ContainsKey(type))
     {
         return false;
     }
     stateTypes.Add(type, state);
     return true;
 }
예제 #2
0
        /// <summary>
        /// Clears the stack cleanly and adds the new state to the stack
        /// </summary>
        public void ChangeState(GameState newState)
        {
            // why do this? --Rich
            while (gameStates.Count > 0)
                PopState();
            // -------------------

            PushState(newState);
            CurrentState.Initialize();
        }
예제 #3
0
 /// <summary>
 /// Adds the given state to the 
 /// </summary>
 public void PushState(GameState newState)
 {
     gameStates.Push(newState);
 }