// Called every frame protected void Update() { if (!controllerEnabled) { return; } // If a target exists ... if (targetLeader.Target != null) { // Track the target and fire gimbalController.TrackPosition(targetLeader.LeadTargetPosition, out firingAngle, false); UpdateFiring(); } // If a target doesn't exist ... else { // Return the turret to center if (noTargetReturnToCenter) { gimbalController.ResetGimbal(false); } if (firing) { StopFiring(); } } }
protected override void InputUpdate() { if (vehicleCamera != null) { if (cycleViewForwardInput.Down()) { vehicleCamera.CycleCameraView(true); if (cameraGimbal != null) { cameraGimbal.ResetGimbal(); } } else if (cycleViewBackwardInput.Down()) { vehicleCamera.CycleCameraView(false); if (cameraGimbal != null) { cameraGimbal.ResetGimbal(); } } } if (vehicleCamera.HasCameraViewTarget && vehicleCamera.SelectedCameraViewTarget.CameraView == VehicleCameraView.Interior) { if (cameraGimbal != null) { if (enableLookAroundInput.Pressed()) { // Look around cameraGimbal.Rotate(new Vector2(cameraGimbalRotationSpeed * horizontalRotationAxisInput.FloatValue(), cameraGimbalRotationSpeed * -verticalRotationAxisInput.FloatValue())); } if (enableLookAroundInput.Up()) { cameraGimbal.ResetGimbal(); } } } }
protected override void InputUpdate() { // Cycle camera view if (cameraEntity != null) { if (cycleViewForwardInput.Down()) { cameraEntity.CycleCameraView(true); } else if (cycleViewBackwardInput.Down()) { cameraEntity.CycleCameraView(false); } } // Select camera view for (int i = 0; i < cameraViewInputs.Count; ++i) { if (cameraViewInputs[i].input.Down()) { cameraEntity.SetView(cameraViewInputs[i].view); } } // Free look mode if (cameraGimbalController != null) { if (freeLookModeInput.Pressed()) { cameraGimbalController.Rotate(lookHorizontalInput.FloatValue() * freeLookSpeed, -lookVerticalInput.FloatValue() * freeLookSpeed); } else if (freeLookModeInput.Up()) { cameraGimbalController.ResetGimbal(true); } } }