public override void Update(GameTime gameTime) { menuComponent.Update(gameTime); if (XInput.CheckKeyReleased(Keys.Space) || XInput.CheckKeyReleased(Keys.Enter) || (menuComponent.MouseOver && XInput.CheckMouseReleased(MouseButtons.Left))) { if (menuComponent.SelectedIndex == 0) { difficulty = "EASY"; manager.ChangeState((PlayState)GameRef.StartPlayState); } else if (menuComponent.SelectedIndex == 1) { difficulty = "MEDIUM"; manager.ChangeState((PlayState)GameRef.StartPlayState); } else if (menuComponent.SelectedIndex == 2) { difficulty = "HARD"; manager.ChangeState((PlayState)GameRef.StartPlayState); } else if (menuComponent.SelectedIndex == 3) { manager.ChangeState((MainMenuState)GameRef.StartMenuState); } } base.Update(gameTime); }
public override void Update(GameTime gameTime) { menuComponent.Update(gameTime); if (XInput.CheckKeyReleased(Keys.Space) || XInput.CheckKeyReleased(Keys.Enter) || (menuComponent.MouseOver && XInput.CheckMouseReleased(MouseButtons.Left))) { if (menuComponent.SelectedIndex == 0) { if (isSoundEnabled) { isSoundEnabled = false; } else if (!isSoundEnabled) { isSoundEnabled = true; } } else if (menuComponent.SelectedIndex == 1) { manager.ChangeState((MainMenuState)GameRef.StartMenuState); } } base.Update(gameTime); }
public void Update(GameTime gameTime) { uiManager.KeyBoardInput(); //if tower is being built, check mouse input if (XInput.CheckMouseReleased(MouseButtons.Left)) { Point mousePoint = XInput.MouseState.Position; uiManager.MouseInput(MouseButtons.Left, mousePoint); } uiManager.Update(gameTime); towerManager.Update(gameTime); enemyManager.Update(gameTime); if (!waveManager.waitingToStartWave(gameTime)) //if waiting time between waves is over { if (!waveManager.AreEnemiesLeft()) //and there arent any more enemies left to spawn this wave { waveManager.StartWave(); //start next wave } else { waveManager.Spawn(gameTime); } } if (gameHealth <= 0) { GameOver('l'); } }
public override void Update(GameTime gameTime) { menuComponent.Update(gameTime); if (XInput.CheckKeyReleased(Keys.Space) || XInput.CheckKeyReleased(Keys.Enter) || (menuComponent.MouseOver && XInput.CheckMouseReleased(MouseButtons.Left))) { if (menuComponent.SelectedIndex == 0) { manager.ChangeState((ChooseMapState)GameRef.StartChooseMapState); } else if (menuComponent.SelectedIndex == 1) { manager.ChangeState((SettingsState)GameRef.StartSettingsState); } else if (menuComponent.SelectedIndex == 2) { Game.Exit(); } } base.Update(gameTime); }
public override void Update(GameTime gameTime) { elapsed += gameTime.ElapsedGameTime; if (XInput.CheckKeyReleased(Keys.Space) || XInput.CheckKeyReleased(Keys.Enter) || XInput.CheckMouseReleased(MouseButtons.Left)) { manager.ChangeState((MainMenuState)GameRef.StartMenuState); } base.Update(gameTime); }