/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { // GameTime updated in frameinfo this.frameInfo.GameTime = gameTime; // InputHandler updated to handle input this.inputHandler.Update(); // Used to change between gamestates if (this.nextState != null) { this.activeGameState = this.nextState; this.nextState = null; } // Update method called in the activegamestate this.activeGameState.Update(); base.Update(gameTime); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. this.SpriteBatch = new SpriteBatch(GraphicsDevice); // GameStates added this.gameStates.Add(new Splash()); this.gameStates.Add(new Menu()); this.gameStates.Add(new Credits()); this.gameStates.Add(new PauseMenu()); this.gameStates.Add(new GameOver()); this.gameStates.Add(new Instructions()); this.gameStates.Add(new LeaderBoard()); this.gameStates.Add(new InGame()); // Splashscreen state set as activegamestate at startup this.activeGameState = this.gameStates[GameState.Splash]; }