/// <summary>Create the level finished state.</summary>
 public LevelFinishedState()
 {
     playingState = GameEnvironment.GameStateManager.GetGameState("playingState");
     SpriteGameObject overlay = new SpriteGameObject("Overlays/spr_welldone");
     overlay.Position = new Vector2(GameEnvironment.Screen.X, GameEnvironment.Screen.Y) / 2 - overlay.Center;
     Add(overlay);
 }
示例#2
0
 public GameOverState()
 {
     playingState = GameEnvironment.GameStateManager.GetGameState("playingState");
     overlay = new SpriteGameObject("Overlays/spr_gameover");
     overlay.Position = new Vector2(GameEnvironment.Screen.X, GameEnvironment.Screen.Y) / 2 - overlay.Center;
     this.Add(overlay);
 }
 public void SwitchTo(string name)
 {
     if (gameStates.ContainsKey(name))
         currentGameState = gameStates[name];
     else
         throw new KeyNotFoundException("Could not find game state: " + name);
 }
示例#4
0
 /// <summary>
 /// Switch to a state.
 /// </summary>
 /// <param name="name">The name of the state to switch to.</param>
 public void SwitchTo(string name)
 {
     activeState = states[name];
 }
示例#5
0
 /// <summary>
 /// Add a state.
 /// </summary>
 /// <param name="name">The name of the state.</param>
 /// <param name="state">The state IGameLoopObject.</param>
 public void AddState(string name, IGameLoopObject state)
 {
     states.Add(name, state);
 }
 public GameStateManager()
 {
     gameStates = new Dictionary<string, IGameLoopObject>();
     currentGameState = null;
 }
 public void AddGameState(string name, IGameLoopObject state)
 {
     gameStates[name] = state;
 }