public override void Update( KeyboardState currentKeyboardState, KeyboardState previousKeyboardState, GamePadState currentGamePadState, GamePadState previousGamePadState) { if (DemoHelper.PressedOnce( Keys.Space, Buttons.A, currentKeyboardState, currentGamePadState, previousKeyboardState, previousGamePadState)) { Reverse(); } if (DemoHelper.PressedOnce( Keys.LeftControl, Buttons.X, currentKeyboardState, currentGamePadState, previousKeyboardState, previousGamePadState)) { ToggleMotorSpeed(); } if (DemoHelper.PressedOnce( Keys.Enter, Buttons.B, currentKeyboardState, currentGamePadState, previousKeyboardState, previousGamePadState)) { _stareAt = !_stareAt; _positionStart = Demo.Camera3D.Target; _sinValue = 0; } if (_stareAt && _sinValue <= Math.PI / 2) { _sinValue += 0.005; Demo.Camera3D.Target = Vector3.Lerp(_positionStart, _chassis3D.Position - _stareAtShift, (float)Math.Sin(_sinValue)); } else if (_stareAt) { Demo.Camera3D.Target = _chassis3D.Position - _stareAtShift; } base.Update(currentKeyboardState, previousKeyboardState, currentGamePadState, previousGamePadState); }
/// <summary> /// Aktualizace scény mezi jednotlivými grafickými vykresleními. /// </summary> /// <param name="currentKeyboardState">Aktuální stav klávesnice.</param> /// <param name="previousKeyboardState">Předchozí stav klávesnice.</param> /// <param name="currentGamePadState">Aktuální stav herního ovladače.</param> /// <param name="previousGamePadState">Předchozí stav herního ovladače.</param> public virtual void Update( KeyboardState currentKeyboardState, KeyboardState previousKeyboardState, GamePadState currentGamePadState, GamePadState previousGamePadState) { DebugView.UpdatePerformanceGraph(Demo.World3D.World2D.UpdateTime); if (DemoHelper.PressedOnce(Keys.F1, currentKeyboardState, previousKeyboardState)) { EnableOrDisableFlag(DebugViewFlags.Shape); } if (DemoHelper.PressedOnce(Keys.F2, currentKeyboardState, previousKeyboardState)) { EnableOrDisableFlag(DebugViewFlags.DebugPanel); EnableOrDisableFlag(DebugViewFlags.PerformanceGraph); } if (DemoHelper.PressedOnce(Keys.F3, currentKeyboardState, previousKeyboardState)) { EnableOrDisableFlag(DebugViewFlags.Joint); } if (DemoHelper.PressedOnce(Keys.F4, currentKeyboardState, previousKeyboardState)) { EnableOrDisableFlag(DebugViewFlags.ContactPoints); EnableOrDisableFlag(DebugViewFlags.ContactNormals); } if (DemoHelper.PressedOnce(Keys.F5, currentKeyboardState, previousKeyboardState)) { EnableOrDisableFlag(DebugViewFlags.PolygonPoints); } if (DemoHelper.PressedOnce(Keys.F6, currentKeyboardState, previousKeyboardState)) { EnableOrDisableFlag(DebugViewFlags.Controllers); } if (DemoHelper.PressedOnce(Keys.F7, currentKeyboardState, previousKeyboardState)) { EnableOrDisableFlag(DebugViewFlags.CenterOfMass); } if (DemoHelper.PressedOnce(Keys.F8, currentKeyboardState, previousKeyboardState)) { EnableOrDisableFlag(DebugViewFlags.AABB); } }