public override void Update(GameTime gameTime) { NewKeyboardState = Keyboard.GetState(); newMouseState = Mouse.GetState(); mousePos = new Point(newMouseState.X, newMouseState.Y); for (int i = 0; i < lstButton.Count; i++) { lstButton[i].Update(gameTime, oldMouseState, newMouseState, mousePos); } //Particle Engine test particleEngine.Update(gameTime); particleEngine.Position = new Vector2(mousePos.X, mousePos.Y); if (NewKeyboardState.IsKeyDown(Keys.Enter) && OldKeyboardState.IsKeyUp(Keys.Enter)) { particleEngine.Load(); } OldKeyboardState = Keyboard.GetState(); base.Update(gameTime); }
public override void Update(GameTime gameTime) { newKeyboardState = Keyboard.GetState(); newMouseState = Mouse.GetState(); mousePos = newMouseState.Position; //GUI gameplayOutput.Update(gameTime, newKeyboardState, oldKeyboardState, newMouseState, oldMouseState, mousePos); if (!gameplayOutput.OverlayActive) { if (newKeyboardState.IsKeyDown(Keys.Enter) && oldKeyboardState.IsKeyUp(Keys.Enter)) { mapSaving = true; mapFile.SavingMap(); Console.WriteLine("saving the game"); mapSaving = false; } if (!mapSaving && buildMode.BuildModeActivated) { buildMode.BuildUpdate(gameTime, newKeyboardState, oldKeyboardState); myCharacter.IsInvisible = true; } else { myCharacter.IsInvisible = false; } base.Update(gameTime); //BuildMode if (newKeyboardState.IsKeyDown(Keys.B) && oldKeyboardState.IsKeyUp(Keys.B)) { buildMode.BuildModeActivated = !buildMode.BuildModeActivated; buildMode.selector.IsInvisible = !buildMode.selector.IsInvisible; } //TileObject for (int i = 0; i < TileObjectList.Count; i++) { if (TileObjectList[i].Delete) { TileObjectList.RemoveAt(i); } else { //TODO update for Tile Object } } if (mapManager.CurrentMap != null) { mapManager.CurrentMap.Update(gameTime); } //Character myCharacter.Update(gameTime, newKeyboardState, oldKeyboardState, newMouseState, oldMouseState, mousePos); //Enemie enemieManager.Update(gameTime); enemieOutput.Update(gameTime); //LightShader lightShaderManager.AmbientColor(timeManager.BackgroundValue); //Camera camera.UpdateCamera(mainGame.GraphicsDevice.Viewport, myCharacter); //TimeManager timeManager.Update(gameTime); //ParticleEngine particleEngine.Update(gameTime); //SpellManager spellManager.Update(gameTime); //LayerManager layerManager.Update(gameTime); map.Update(gameTime); } oldKeyboardState = Keyboard.GetState(); oldMouseState = Mouse.GetState(); }