protected override void Update(GameTime gameTime) { if (started) { if (!player.alive) { Platform.z_position = 0; Platform.last_platform = new int[, ] { { -1, 0 }, { -1, 0 }, { -1, 0 }, { -1, 0 }, { -1, 0 } }; Platform.next_platform = new int[, ] { { 1, 0 }, { 1, 0 }, { 1, 0 }, { 1, 0 }, { 1, 0 } }; Platform.standing_platform = null; Platform.next_standing_platform = null; SetGameObjects(); started = false; mainPage.EndGame(score); } else { lightManager.Update(); keyboardState = keyboardManager.GetState(); flushAddedAndRemovedGameObjects(); // pass gameTime to let camera move along camera.Update(gameTime, player.pos); accelerometerReading = input.accelerometer.GetCurrentReading(); for (int i = 0; i < gameObjects.Count; i++) { gameObjects[i].Update(gameTime); } // Update score board on the game page mainPage.UpdateScore(score); // Update camera and player position for testing mainPage.DisplayCameraPlayerPos(camera.Position, camera.cameraPos, player.pos, player.max_speed); mainPage.UpdateShootButton(player.fireOn); if (keyboardState.IsKeyDown(Keys.Escape)) { this.Exit(); this.Dispose(); App.Current.Exit(); } // Handle base.Update } } base.Update(gameTime); }
public override void Update(GameTime gameTime) { // Change the platform if the camera passed it if (game.camera.Position.Z < z_position_end) { change_platform(); } Update_player_platforms(); min_extra_tiles = (int)(max_extra_tiles - game.difficulty); WorldInverseTranspose = Matrix.Transpose(Matrix.Invert(World)); //Update the parameters lightManager.Update(); lightManager.SetLighting(effect); effect.Parameters["World"].SetValue(World); effect.Parameters["Projection"].SetValue(game.camera.Projection); effect.Parameters["View"].SetValue(game.camera.View); effect.Parameters["cameraPos"].SetValue(game.camera.Position); effect.Parameters["worldInvTrp"].SetValue(WorldInverseTranspose); }