public EState Update(GameTime gameTime) { MouseState mouseState = Mouse.GetState(); cursorPos = new Vector2(mouseState.X, mouseState.Y); if (returnToGame.Check(mouseState)) { GameStuff.togglePause(); } options.Check(mouseState); if (returnToMain.Check(mouseState)) { GameStuff.Instance.currentState = EState.MainMenu; } if (exit.Check(mouseState)) { Environment.Exit(0); } if (retry.Check(mouseState)) { GameStuff.setGameState(EState.PlayState); } return(EState.Pause); }
public EState Update(GameTime gameTime) { MediaPlayer.Stop(); if (!Keyboard.GetState().IsKeyDown(Keys.Enter) && !Keyboard.GetState().IsKeyDown(Keys.Space)) { return(EState.Death); } GameStuff.Instance.mainMenu.reset(); GameStuff.setGameState(EState.MainMenu); return(EState.Death); }
/// <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) { //Debug-Stuff //if (Keyboard.GetState().IsKeyDown(Keys.K)) GameStuff.setGameState(EState.Death); if (Keyboard.GetState().IsKeyDown(Keys.F11) && releasedFsT) { //GameStuff.toggleScreen(graphics); releasedFsT = false; graphics.ToggleFullScreen(); } if (Keyboard.GetState().IsKeyUp(Keys.F11)) { releasedFsT = true; } if (Keyboard.GetState().IsKeyDown(Keys.Escape) && releasedEsc && ((GameStuff.Instance.currentState == EState.PlayState) || GameStuff.Instance.currentState == EState.Pause)) { GameStuff.togglePause(); releasedEsc = false; } if (Keyboard.GetState().IsKeyUp(Keys.Escape)) { releasedEsc = true; } if (GameStuff.Instance.currentState == EState.PlayState) { GameStuff.Instance.currentState = GameStuff.Instance.stage.Update(gameTime); } if (GameStuff.Instance.currentState == EState.MainMenu) { GameStuff.Instance.mainMenu.Update(gameTime); } if (GameStuff.Instance.currentState == EState.Death) { GameStuff.Instance.death.Update(gameTime); } if (GameStuff.Instance.currentState == EState.Pause) { GameStuff.Instance.pause.Update(gameTime); } if (GameStuff.Instance.player != null && GameStuff.Instance.player.getHealth() <= 0) { GameStuff.setGameState(EState.Death); GameStuff.Instance.player.applyDamage(-100); } base.Update(gameTime); }
public EState Update(GameTime gameTime) { MouseState mouseState = Mouse.GetState(); cursorPos = new Vector2(mouseState.X, mouseState.Y); if (splash.Check(mouseState)) { changeButtons(0); } if (play.Check(mouseState)) { changeButtons(1); } if (stageOne.Check(mouseState)) { GameStuff.setGameState(EState.PlayState); } stageTwo.Check(mouseState); stageThree.Check(mouseState); options.Check(mouseState); if (about.Check(mouseState)) { changeButtons(3); //TODO: Print some Shit } if (exit.Check(mouseState)) { Environment.Exit(0); } if (Keyboard.GetState().IsKeyDown(Keys.Escape)) { GameStuff.Instance.mainMenu.reset(); } return(EState.MainMenu); }