/// <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) { if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) { Exit(); } // TODO: Add your update logic here if (state == "StartScreen") { StartButton.Update(gameTime); } else if (state == "Menu") { Stage1Button.Update(gameTime); Stage2Button.Update(gameTime); Stage3Button.Update(gameTime); } else if (state == "Stage1") { waveManeger.Update(gameTime); player.Update(gameTime, waveManeger.Enemies); arrowButton.Update(gameTime); slowButton.Update(gameTime); snipeButton.Update(gameTime); } else if (state == "Stage2") { waveManeger2.Update(gameTime); player.Update(gameTime, waveManeger.Enemies); arrowButton.Update(gameTime); slowButton.Update(gameTime); snipeButton.Update(gameTime); } else { waveManeger.Update(gameTime); player.Update(gameTime, waveManeger.Enemies); arrowButton.Update(gameTime); slowButton.Update(gameTime); snipeButton.Update(gameTime); } base.Update(gameTime); }
/// <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) { if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) { Exit(); } // TODO: Add your update logic here waveManeger.Update(gameTime); player.Update(gameTime, waveManeger.Enemies); base.Update(gameTime); base.Update(gameTime); }