public void OnTick(object sender, EventArgs e) { if (_shutDownRequestFlag) { return; } _tobiiTracker.Update(); _debugGazeVisualization.Move(new Vector2(TobiiAPI.GetGazePoint().X *UI.WIDTH, TobiiAPI.GetGazePoint().Y *UI.HEIGHT)); _controllerEmulation.Enabled = !Game.IsPaused; _mouseEmulation.Enabled = !Game.IsPaused && !_menuPool.IsAnyMenuOpen() && _isWindowForeground; //CheckFreelookDevice(); SaveSettingsOnMenuClosed(); Game.Player.Character.CanBeKnockedOffBike = _settings.DontFallFromBikesEnabled; //Bug in Script hook if (Game.IsPaused) { return; } if (!_settings.UserAgreementAccepted) { _introScreen.OpenMenu(); } RecordGameSessionStarted(); Vector3 shootCoord; Vector3 shootCoordSnap; Vector3 shootMissileCoord; Ped ped; Entity missileTarget; var controllerState = _controllerEmulation.ControllerState; const float joystickRadius = 0.1f; var joystickDelta = new Vector2(controllerState.Gamepad.RightThumbX, -controllerState.Gamepad.RightThumbY) * (1.0f / 32768.0f) * joystickRadius; _gameState.Update(); var centeredNormalizedGaze = new Vector2(TobiiAPI.GetGazePoint().X, TobiiAPI.GetGazePoint().Y) * 2 - new Vector2(1, 1); _gazeProjector.FindGazeProjection( centeredNormalizedGaze, joystickDelta, out shootCoord, out shootCoordSnap, out shootMissileCoord, out ped, out missileTarget); _controlsProcessor.Update(_lastTickTime, shootCoord, shootCoordSnap, shootMissileCoord, ped, missileTarget); //_aiming.TurnHead(ped, shootCoord); _menuPool.ProcessMenus(); _animationHelper.Process(); if (_debugOutput.Visible) { _debugGazeVisualization.Render(); } _debugOutput.Process(); _mouseEmulation.ProcessInput(); _lastTickTime = DateTime.UtcNow; if (_shutDownRequestFlag) { _shutDownRequestedEvent.Set(); } }
public void OnTick(object sender, EventArgs e) { _controllerEmulation.Enabled = !Game.IsPaused; _mouseEmulation.Enabled = !Game.IsPaused && !_menuPool.IsAnyMenuOpen() && _isWindowForeground; CheckFreelookDevice(); var lastMenuOpen = _menuOpen; _menuOpen = _menuPool.IsAnyMenuOpen(); if (lastMenuOpen && !_menuOpen) { SaveSettings(); } _isPaused = Game.IsPaused; Game.Player.Character.CanBeKnockedOffBike = _settings.DontFallFromBikesEnabled; //Bug in Script hook CheckUserPresense(); if (Game.IsPaused) { return; } _isInVehicle = Game.Player.Character.IsInVehicle(); _isInAircraft = Game.Player.Character.IsInPlane || Game.Player.Character.IsInHeli; Vector3 shootCoord; Vector3 shootCoordSnap; Vector3 shootMissileCoord; Ped ped; FindGazeProjection(out shootCoord, out shootCoordSnap, out shootMissileCoord, out ped); ProcessControls(shootCoord, shootCoordSnap, shootMissileCoord); //TurnHead(ped, shootCoord); _menuPool.ProcessMenus(); _aiming.Process(); _gazeVisualization.Process(); _debugOutput.Process(); if (_settings.PedestrianInteractionEnabled) { if (ped != null && ped.Handle != Game.Player.Character.Handle) { _pedestrianInteraction.ProcessLookingAtPedestrion(ped, _tickStopwatch.Elapsed); } _pedestrianInteraction.Process(); } DrawDeadzones(); DeadzoneCreator(); DeadzoneMonitor(); _mouseEmulation.ProcessInput(); _tickStopwatch.Restart(); }
public void OnTick(object sender, EventArgs e) { if (_shutDownRequestFlag) { return; } _controllerEmulation.Enabled = !Game.IsPaused; _mouseEmulation.Enabled = !Game.IsPaused && !_menuPool.IsAnyMenuOpen() && _isWindowForeground; CheckFreelookDevice(); SaveSettingsOnMenuClosed(); Game.Player.Character.CanBeKnockedOffBike = _settings.DontFallFromBikesEnabled; //Bug in Script hook CheckUserPresense(); if (Game.IsPaused) { return; } if (!_settings.UserAgreementAccepted) { _introScreen.OpenMenu(); } RecordGameSessionStarted(); Vector3 shootCoord; Vector3 shootCoordSnap; Vector3 shootMissileCoord; Ped ped; Entity missileTarget; //Util.Log("0 - " + DateTime.UtcNow.Ticks); var controllerState = _controllerEmulation.ControllerState; const float joystickRadius = 0.1f; var joystickDelta = new Vector2(controllerState.Gamepad.RightThumbX, -controllerState.Gamepad.RightThumbY) * (1.0f / 32768.0f) * joystickRadius; //Util.Log("1 - " + DateTime.UtcNow.Ticks); _gazeProjector.FindGazeProjection( _lastNormalizedCenterDelta, joystickDelta, out shootCoord, out shootCoordSnap, out shootMissileCoord, out ped, out missileTarget); //Util.Log("2 - " + DateTime.UtcNow.Ticks); _controlsProcessor.Process(_lastTickTime, _lastNormalizedCenterDelta, _aspectRatio, shootCoord, shootCoordSnap, shootMissileCoord, ped, missileTarget); //Util.Log("3 - " + DateTime.UtcNow.Ticks); //_aiming.TurnHead(ped, shootCoord); _menuPool.ProcessMenus(); //Util.Log("4 - " + DateTime.UtcNow.Ticks); _animationHelper.Process(); //Util.Log("5 - " + DateTime.UtcNow.Ticks); if (_debugOutput.Visible) { _debugGazeVisualization.Render(); } _debugOutput.Process(); //Util.Log("6 - " + DateTime.UtcNow.Ticks); _pedestrianInteraction.Process(ped, DateTime.UtcNow - _lastTickTime); //Util.Log("7 - " + DateTime.UtcNow.Ticks); _deadzoneEditor.Process(); _mouseEmulation.ProcessInput(); //Util.Log("8 - " + DateTime.UtcNow.Ticks); _lastTickTime = DateTime.UtcNow; if (_shutDownRequestFlag) { _shutDownRequestedEvent.Set(); } }