/// <summary> /// Draws the specified game time. /// </summary> /// <param name="gameTime">The game time.</param> protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); //chooses the appropriate state to draw switch (State) { case GameState.Game: GameScene.Draw(spriteBatch); break; case GameState.Shop: GameScene.Draw(spriteBatch); Shop.Instance.Draw(spriteBatch); break; case GameState.Menu: Menu.Draw(spriteBatch); break; case GameState.LoseScreen: GameScene.Draw(spriteBatch); LoseScreen.Draw(spriteBatch); break; case GameState.Pause: GameScene.Draw(spriteBatch); PauseMenu.Draw(spriteBatch); break; case GameState.Instructions: Instructions.Draw(spriteBatch); break; } base.Draw(gameTime); }
/// <summary> /// Updates the state from the user input. /// </summary> public static void Update() { //check wether play again button was clicked if (playAgainBtn.Update()) { //go to game scene TankGame.State = GameState.Game; //reset game and shop scene GameScene.Reset(); Shop.Reset(); } //chekc if back to menu button is pressed if (backToMenuBtn.Update()) { //go to menu scene TankGame.State = GameState.Menu; //reset game and shop scene GameScene.Reset(); Shop.Reset(); } }