public AsteroidGame(Game game, GraphicsDeviceManager g, SpriteBatch sb) : base(game, g, new Rectangle(0, 0, 600, 600), sb) { _gs = new GameState(this); CurrentState = _gs; _pausestate = new PauseState(this); }
public void GameOver() { if (GameState == GameState.GameOver) return; RefreshHighScores(); InteractionLogic.PauseUpdate(); InteractionLogic.Player.Dispose(); GameState = GameState.GameOver; controls.SetControlsToState(GameState); HudInterface.SetGameOverText(); }
public void SetControlsToState(GameState state) { for (int i = 0; i < commandsInUse; i++) controlCommands[i].Dispose(); commandsInUse = 0; switch (state) { case GameState.Playing: AddPlayerAccelerationControl(); AddPlayerSteerLeft(); AddPlayerSteerRight(); AddPlayerShootingControls(); AddPlayerMoveDirectly(); break; case GameState.GameOver: AddRestartControl(); AddMainMenuControl(); break; default: return; //ncrunch: no coverage } }
public void StartGame() { mainMenu.Hide(); Show(); controls = new Controls(this); score = 0; GameState = GameState.Playing; InteractionLogic.BeginGame(); SetUpEvents(); controls.SetControlsToState(GameState); HudInterface = new HudInterface(); }
public void RestartGame() { InteractionLogic.Restart(); score = 0; HudInterface.SetScoreText(score); HudInterface.SetInGameMode(); GameState = GameState.Playing; controls.SetControlsToState(GameState); }