protected override void Update() { base.Update(); _keyInput.Update(this); _directionInput.Update(Input.mousePosition, Camera.main.WorldToScreenPoint(Position), this); }
protected override void Update(GameTime gameTime) { HandleInput(gameTime); _sceneManager.Update(gameTime); base.Update(gameTime); KeyInput.Update(gameTime); MouseInput.Update(gameTime); }
protected override void Update(GameTime time) { var elapsed = (float)time.ElapsedGameTime.TotalSeconds; var frameTime = new FrameTime(elapsed, TimeScale); var keyState = Keyboard.GetState(); KeyInput.Update(keyState); MouseInput.Update(); ToggleHotspotBoxes.Perform(this); ToggleQuitGame.Perform(this); ToggleFullscreen.Perform(this); ToggleEditingMode.Perform(this); ReloadGameInterface.Perform(this); RefreshHotspotsState.Perform(this); RefreshToysState.Perform(this); RefreshBackgroundElements.Perform(this); EditingMouseGrab.Perform(this); if (State == GameState.WaitingForClient) { Customer.State = Customer.StateType.Waiting; GenerateNewCustomer.Perform(this, frameTime); } if (State == GameState.FixingToy) { Customer.State = Customer.StateType.Waiting; HandleHotspotInteraction.Perform(this); ResolveCurrentToy.Perform(this); HandlePaymentProcess.Paid = false; HandlePaymentProcess.Delay = 1.5f; } if (State == GameState.ClientPayment) { Customer.State = Customer.StateType.Happy; HandlePaymentProcess.Perform(this, frameTime); } if (State == GameState.ClientLeaving) { Customer.State = Customer.StateType.Waiting; GameInterface.SpeechSprite.Tint = new Color(GameInterface.SpeechSprite.Tint, 0.0f); GenerateNewCustomer.WaitTime = GetRandom.Float(1.0f, 2.0f); ChangeState(GameState.WaitingForClient); } Clock.Update(frameTime); GameCamera.Update(GraphicsDevice.Viewport); DebugMonitor.Update(frameTime); base.Update(time); }
/// <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) { base.Update(gameTime); GameTimes.UpdateTimes(gameTime); KeyInput.Update(); _camera.Update(); _currentState.Update(); if (KeyInput.JustPressedKey(Keys.F12)) { GlobalState.ShowFPS = !GlobalState.ShowFPS; } }
protected override void Update(GameTime gameTime) { if (!IsActive) { return; } float elapsed = (float)gameTime.ElapsedGameTime.TotalMinutes; timerCounter -= elapsed; if (timerCounter < 0) { GenerateUpgrades(); timerCounter = timer; } KeyInput.Update(gameTime); UserInterface.Update(gameTime); switch (gameState) { case GameState.MainGame: //main game GameLogic(gameTime); break; case GameState.EndScreen: //gameover EndScreenLogic(); break; case GameState.MainMenu: //main menu MenuLogic(); break; case GameState.SettingsMenu: //settings SettingsLogic(); break; case GameState.ShopMenu: GameLogic(gameTime); break; case GameState.PauseMenu: PauseMenuLogic(); break; } base.Update(gameTime); }
/// <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) { base.Update(gameTime); GameTimes.UpdateTimes(gameTime); KeyInput.Update(); if (GlobalState.settings.pause_on_unfocus && !IsActive) { return; } _currentState.Update(); _camera.Update(); foreach (var effect in GlobalState.AllEffects.Where(e => e.Active())) { effect.Update(); } if (KeyInput.JustPressedKey(Keys.F12)) { GlobalState.ShowFPS = !GlobalState.ShowFPS; } if (GlobalState.ClosingGame) { Exit(); } if (GlobalState.ResolutionDirty) { InitGraphics(); GlobalState.ResolutionDirty = false; } }