private void FixedUpdate() { if (ship == null || ship.engine == null) { return; } var engine = ship.engine; switch (mouseState) { case MouseState.Off: engine.LerpYawToNeutral(); break; case MouseState.Toggled: case MouseState.Held: engine.AddPitch(GameStateUtils.GetMousePositionOnScreen().y); engine.AddYaw(GameStateUtils.GetMousePositionOnScreen().x); break; default: Debug.LogWarning("MouseState has incorrect value..."); break; } }
private void CalculateOffsets() { var mouseCoords = GameStateUtils.GetMousePositionOnScreen(); distanceOffset = Mathf.Clamp(Speed / speedDivisor, 0, maxDistance); if (calculateRotationOffsets) { pitchOffset = Mathf.Clamp(mouseCoords.y * pitchModifier, maxLowerPitch, maxUpperPitch); yawOffset = Mathf.Clamp(mouseCoords.x * yawModifier, -maxYaw, maxYaw); } else { pitchOffset = 0; yawOffset = 0; } }