/// <summary> /// Allows the game component to update itself. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> public override void Update(GameTime gameTime) { float time = (float)gameTime.TotalGameTime.TotalMilliseconds / 1000.0f; MouseState mouseState = Mouse.GetState(); KeyboardState keyState = Keyboard.GetState(); //Console.WriteLine(levelHander.GetGameState.ToString()); if (levelHander.GetGameState == GameLevelHandler.GameState.INITIALIZE) { playerHealth = player.hp; playerScore = player.score; octreeWorld = new Octree(game, this, worldData); LoadWorldModels(); octreeWorld.Initialize(levelHander.GetEmemyData, tankStatus, gameTime, player); Game.Components.Remove(gameMenu); Game.Components.Add(camera); music = new Music(game); game.IsMouseVisible = false; textHandler.UpdateText(this); city.SetUpCity(Game.GraphicsDevice, sceneryTexture); music.BackGroundPlay(); levelHander.SetGameState = GameLevelHandler.GameState.PLAY; } else if (levelHander.GetGameState == GameLevelHandler.GameState.PLAY) { levelHander.UpdateGameStatus(playerScore, playerHealth); textHandler.UpdateText(this); inputHandler.UpdateWorld(gameTime, camera, this, music); octreeWorld.Update(gameTime, camera, levelHander.GetEmemyData); explosionHandler.Update(gameTime); } else if (levelHander.GetGameState == GameLevelHandler.GameState.FINISHING) { Game.Components.Remove(camera); music.BackgroundStop(); game.IsMouseVisible = true; levelHander = new GameLevelHandler(Game.Content); gameMenu = new GameMenuScreen(game, levelHander); Game.Components.Add(gameMenu); levelHander.SetFinalScore(playerScore); levelHander.SetGameState = GameLevelHandler.GameState.END; } }