/// <inheritdoc /> /// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> protected override void Update(GameTime gameTime) { if (!IsReadyToUpdate) { return; } base.Update(gameTime); if (SteamManager.IsInitialized) { SteamAPI.RunCallbacks(); } // Run scheduled background tasks CommonTaskScheduler.Run(); BackgroundManager.Update(gameTime); BackgroundHelper.Update(gameTime); NotificationManager.Update(gameTime); ChatManager.Update(gameTime); DialogManager.Update(gameTime); HandleGlobalInput(gameTime); QuaverScreenManager.Update(gameTime); Transitioner.Update(gameTime); SkinManager.HandleSkinReloading(); LimitFpsOnInactiveWindow(); }
public void Update(GameTime aTime) { myBackground.Update(aTime); foreach (Button button in myButtons) { button.Update(aTime); } Input(); }
protected override void Update(GameTime gameTime) { if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) { Exit(); } bm.Update(); em.Update(); base.Update(gameTime); }
public void Update(IGameTimeService gameTime) { Camera.Pos = ConvertUnits.ToDisplayUnits(_clientShipManager.PlayerShip.Position); Camera.UpdateCameraShake(); // Todo: See if zooming in space is broken, if it is, then finish refactoring RotationalCamera away. //Temporary fix for now, it was broken. if (MouseManager.ScrolledUp || GamepadManager.ZoomIn.IsBindTapped()) { ConsoleManager.WriteLine("Warning: Implement UI Zoom using ChangeZoom container."); Camera.Zoom += .1f; } if (MouseManager.ScrolledDown || GamepadManager.ZoomOut.IsBindTapped()) { ConsoleManager.WriteLine("Warning: Implement UI Zoom using ChangeZoom container."); Camera.Zoom -= .1f; } if (_spaceViewModel.StructurePlacementModeEnabled) { if (MouseManager.RightButtonPressed) { // Cancel with right click _spaceViewModel.StructurePlacementModeEnabled = false; } } if (_clientShipManager.PlayerShip != null) { var shipDifference = _oldPosition - ConvertUnits.ToDisplayUnits(_clientShipManager.PlayerShip.Position); _background.Update(_clientShipManager.PlayerShip.Position, shipDifference); _spaceObjectManager.Update(gameTime, _clientShipManager.PlayerShip != null && _clientShipManager.PlayerShip.EnterMode); _oldPosition = ConvertUnits.ToDisplayUnits(_clientShipManager.PlayerShip.Position); } }
public override void Update(GameTime gameTime) { StateControl(); query = "SELECT Currency FROM [Saves] WHERE ID = " + saveID; int result = int.Parse(dBManager.SelectElement(query)); currencyDisplay.value = result + " CC"; //cleo upp BackgroundManager.Update(_camera); //PlanetManager.Update(gameTime,_player.ControlledShip.Position); foreach (var ship in _convoy) { ShipUpdate(ship, gameTime, _enemies); } foreach (var ship in _enemies) { ShipUpdate(ship, gameTime, _convoy); } foreach (var sprite in _sprites) { if (!(sprite is Ship)) { sprite.Update(gameTime, _sprites); } } //Update pentru ambele tabere //Update pentru elemente de UI foreach (var co in UI) { co.Update(gameTime); } shipYard.Update(gameTime, _player.ControlledShip.Position, this, dBManager); if (_convoy.Count == 0) { game.ChangeStates(new GameOverState(game, graphicsDevice, contentManager)); } else { _player.Update(gameTime, _sprites, _convoy); _camera.Update(_player.ControlledShip, _player.Input); } EnterTrade(); var timer = (float)gameTime.ElapsedGameTime.TotalSeconds; secondsElapsed -= timer; if (secondsElapsed <= 0) { RandomizePlanetInventory(); secondsElapsed = secondsToBeElapsed; } _combatManager.Update(gameTime, _camera, _convoy.Concat(_enemies).ToList(), this); PostUpdate(gameTime); //base.Update(gameTime); }
public void Update(GameTime gameTime, GraphicsDevice graphics) { marcoPlayer.Update(gameTime, graphics); background.Update(gameTime, marcoPlayer._position); collisionWithMap(); }
/// <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) { _fire_bullet_time += gameTime.ElapsedGameTime.TotalMilliseconds; int Highscore = 0; var ks = Keyboard.GetState(); var ms = Mouse.GetState(); hack: switch (_state) { case CGameState.MainScreen: var ret = _mainscreen.Update(ms); if (ret.HasValue && (ret.Value == CGameState.Quit || ret.Value == CGameState.StartGame || ret.Value == CGameState.CreditsScreen)) { _state = ret.Value; goto hack; } break; case CGameState.CreditsScreen: if (_creditsScreen == null) { LoadCreditsScreen(); } ret = _creditsScreen.Update(ms); if (ret.HasValue && ret.Value == CGameState.MainScreen) { _state = ret.Value; goto hack; } break; case CGameState.StartGame: LoadGame(); break; case CGameState.Playing: if (ms.LeftButton == ButtonState.Pressed && _fire_bullet_time > 180) { _bullet_manager.Add(_player.GetPosition(), _player.GetDirection()); _fire_bullet_time = 0; } _player.Update(ks, ms); _background_manager.Update(_wave_manager.WaveCount, _wave_manager.Highscore); _bullet_manager.Update(); _bullet_hits_enemy.Update(); _portal_manager.Update(); _energy_storage_manager.Update(); _powerup_manager.Update(gameTime, ref _player, ref _energy_storage_manager); _enemy_managers.Values .ToList() .ForEach(x => x.Update(ref Highscore, gameTime)); _wave_manager.Update(gameTime, ref Highscore); //game over if (_energy_storage_manager._energy_storages.Count == 0) { _state = CGameState.Gameover; goto hack; } break; case CGameState.Gameover: if (_gameoverscreen == null) { LoadGameOver(_wave_manager.Highscore); } ret = _gameoverscreen.Update(ms); if (ret.HasValue && ret.Value == CGameState.StartGame) { _state = ret.Value; goto hack; } else if (ret.HasValue && ret.Value == CGameState.Quit) { _state = ret.Value; goto hack; } break; case CGameState.Quit: Exit(); break; } if (ks.IsKeyDown(Keys.Escape)) { Exit(); } base.Update(gameTime); }
/// <inheritdoc /> /// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> protected override void Update(GameTime gameTime) { if (!IsReadyToUpdate) { return; } base.Update(gameTime); if (SteamManager.IsInitialized) { SteamAPI.RunCallbacks(); } // Run scheduled background tasks CommonTaskScheduler.Run(); BackgroundManager.Update(gameTime); BackgroundHelper.Update(gameTime); NotificationManager.Update(gameTime); ChatManager.Update(gameTime); DialogManager.Update(gameTime); // Handles FPS limiter changes if (KeyboardManager.IsUniqueKeyPress(Keys.F7)) { var index = (int)ConfigManager.FpsLimiterType.Value; if (index + 1 < Enum.GetNames(typeof(FpsLimitType)).Length) { ConfigManager.FpsLimiterType.Value = (FpsLimitType)index + 1; } else { ConfigManager.FpsLimiterType.Value = FpsLimitType.Unlimited; } switch (ConfigManager.FpsLimiterType.Value) { case FpsLimitType.Unlimited: NotificationManager.Show(NotificationLevel.Info, "FPS is now unlimited."); break; case FpsLimitType.Limited: NotificationManager.Show(NotificationLevel.Info, $"FPS is now limited to: 240 FPS"); break; case FpsLimitType.Vsync: NotificationManager.Show(NotificationLevel.Info, $"Vsync Enabled"); break; case FpsLimitType.Custom: NotificationManager.Show(NotificationLevel.Info, $"FPS is now custom limited to: {ConfigManager.CustomFpsLimit.Value}"); break; default: throw new ArgumentOutOfRangeException(); } } QuaverScreenManager.Update(gameTime); Transitioner.Update(gameTime); }