コード例 #1
0
 /// <summary>
 /// Constructs the gameState and passes Game and GameStateManager.
 /// </summary>
 /// <param name="game">game drawable component</param>
 /// <param name="manager">the stateManager</param>
 public GameState(Game game, GameStateManager manager)
     : base(game)
 {
     GameRef = (Game1)game;
         StateMananger = manager;
         stateRef = this;
 }
コード例 #2
0
        /// <summary>
        /// Push a state onto the stack.
        /// Adds it to the components list
        /// </summary>
        /// <param name="newState">GameState to be added</param>
        public void PushState(GameState newState)
        {
            if (gameStates.Count > 0)
                gameStates.Peek().HasFocus = false;

            gameStates.Push(newState);
            Game.Components.Add(newState);
            gameStates.Peek().HasFocus = true;
        }
コード例 #3
0
ファイル: GameStateManager.cs プロジェクト: TristanZeph/XRDtS
 /// <summary>
 /// Pushes a gameState to the stack. Calls LoadContent()
 /// </summary>
 public void PushState(GameState state)
 {
     state.LoadContent();
     gameStates.Push(state);
 }
コード例 #4
0
ファイル: GameStateManager.cs プロジェクト: TristanZeph/XRDtS
 /// <summary>
 /// Pops current state and pushes the new state to the stack.
 /// </summary>
 public void ChangeState(GameState state)
 {
     PopState();
     PushState(state);
 }
コード例 #5
0
 /// <summary>
 /// Pops the previous state and pushes a new state to the stack.
 /// </summary>
 /// <param name="newState">GameState to be added</param>
 public void ChangeState(GameState newState)
 {
     PopState();
     PushState(newState);
 }