/// <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) { switch (state) { case State.Splash: splash.Update(gameTime); if (splash.finished) { state = State.Intro; } break; case State.Intro: introScreen.Update(gameTime); if (introScreen.IsDone) { state = State.MainMenu; mainMenu.IsShowing = true; } break; case State.MainMenu: // main menu switches to the game state itself mainMenu.Update(gameTime); if (!mainMenu.IsShowing) { state = State.Game; } break; case State.Tutorial1: if (GamePad.GetState(PlayerIndex.One).IsButtonDown(Buttons.A) && !press) { state = State.Tutorial2; } press = GamePad.GetState(PlayerIndex.One).IsButtonDown(Buttons.A); break; case State.Tutorial2: if (GamePad.GetState(PlayerIndex.One).IsButtonDown(Buttons.A) && !press) { state = State.MainMenu; } press = GamePad.GetState(PlayerIndex.One).IsButtonDown(Buttons.A); break; case State.Game: winScreen.Update(gameTime); if (!winScreen.IsShowing) { //tutorial.Update(gameTime); if (!tutorial.IsShowing) { InputManager.Update(gameTime); manager.Update(gameTime); hut.Update(gameTime); temples[PlayerIndex.One].Update(gameTime); temples[PlayerIndex.Two].Update(gameTime); temples[PlayerIndex.Three].Update(gameTime); temples[PlayerIndex.Four].Update(gameTime); players[PlayerIndex.One].Update(gameTime); players[PlayerIndex.Two].Update(gameTime); players[PlayerIndex.Three].Update(gameTime); players[PlayerIndex.Four].Update(gameTime); comboOne.Update(gameTime); comboOne.Position = new Vector2((int)playerOne.position.X, (int)playerOne.position.Y); comboTwo.Update(gameTime); comboTwo.Position = new Vector2((int)playerTwo.position.X, (int)playerTwo.position.Y); comboThree.Update(gameTime); comboThree.Position = new Vector2((int)playerThree.position.X, (int)playerThree.position.Y); comboFour.Update(gameTime); comboFour.Position = new Vector2((int)playerFour.position.X, (int)playerFour.position.Y); HUD.Update(gameTime); terrain.Update(gameTime); //tutorial.IsShowing = !tutorial.demigodDone; } } break; } /* * else * mainMenu.IsShowing = true; * * if (splash.finished && mainMenu.IsShowing) * mainMenu.Update(gameTime); * winScreen.Update(gameTime); * * if (!winScreen.IsShowing) * { * if (mainMenu.IsShowing) * { * //mainMenu.Update(gameTime); * } * else * { * * } * * * } */ //Window.Title = Mouse.GetState().X.ToString() + " " + Mouse.GetState().Y.ToString(); Window.Title = "FPS: " + Math.Round((1000 / gameTime.ElapsedGameTime.TotalMilliseconds)).ToString() + " peon count: " + manager.Peons.Count.ToString(); Window.Title = Mouse.GetState().X.ToString() + " " + Mouse.GetState().Y.ToString(); base.Update(gameTime); }