Example #1
0
        public static float CameraZoom(ref CameraMovementJobState CameraMovementJobStateStruct)
        {
            var CameraObject    = CameraMovementJobStateStruct.CameraObject;
            var CameraZoomState = CameraMovementJobStateStruct.CameraZoomState;

            var zoomDelta = -1 * CameraZoomState.DelteZoomFromInput * CameraMovementJobStateStruct.d;

            if (zoomDelta != 0f)
            {
                CameraZoomState.TargetSize = math.clamp(CameraZoomState.TargetSize + zoomDelta, MinCameraSize, MaxCameraSize);
            }

            CameraMovementJobStateStruct.CameraZoomState = CameraZoomState;

            return(math.lerp(CameraObject.CameraSize, CameraZoomState.TargetSize, CameraMovementJobStateStruct.d * 4f));
        }
Example #2
0
        public static quaternion CameraVerticalRotation(ref CameraMovementJobState CameraMovementJobStateStruct)
        {
            var TargetCursorComponent       = CameraMovementJobStateStruct.TargetCursorComponent;
            var CameraObject                = CameraMovementJobStateStruct.CameraObject;
            var CameraVerticalRotationState = CameraMovementJobStateStruct.CameraVerticalRotationState;

            var clampedYCursorScreenPosition = 1 - math.clamp(TargetCursorComponent.TargetCursorScreenPosition.y, 0, 1);

            var targetVerticalAngle = math.lerp(CameraVerticalRotationState.MinAngle, CameraVerticalRotationState.MaxAngle, clampedYCursorScreenPosition);

            CameraVerticalRotationState.CurrentDeltaAngle =
                math.lerp(CameraVerticalRotationState.CurrentDeltaAngle, targetVerticalAngle,
                          math.clamp(CameraVerticalRotationState.DampingSpeed * CameraMovementJobStateStruct.d, 0f, 1f));
            CameraMovementJobStateStruct.CameraVerticalRotationState = CameraVerticalRotationState;

            return(quaternion.RotateX(math.radians(CameraVerticalRotationState.CurrentDeltaAngle)));
        }
Example #3
0
        public static float3 CameraPanningMovement(ref CameraMovementJobState CameraMovementJobStateStruct)
        {
            var TargetCursorComponent = CameraMovementJobStateStruct.TargetCursorComponent;
            var CameraObject          = CameraMovementJobStateStruct.CameraObject;
            var CameraPanningState    = CameraMovementJobStateStruct.CameraPanningState;

            CameraPanningState.TargetWorldOffset =
                math.inverse(math.mul(CameraObject.CameraProjectionMatrix, CameraObject.WorldToCameraMatrix)).MultiplyVector(
                    new float3(TargetCursorComponent.TargetCursorScreenPosition, 0f)) * CameraPanningState.ScreenMovementIntensity;
            CameraPanningState.CurrentWorldOffset =
                math.lerp(CameraPanningState.CurrentWorldOffset, CameraPanningState.TargetWorldOffset,
                          math.clamp(CameraPanningState.DampingSpeed * CameraMovementJobStateStruct.d, 0f, 1f));

            CameraMovementJobStateStruct.CameraPanningState = CameraPanningState;

            return(CameraPanningState.CurrentWorldOffset);
        }
Example #4
0
 public void SetupJob(ref CameraMovementJobState CameraMovementJobState)
 {
     CameraMovementJobState.CameraZoomState.DelteZoomFromInput = this.gameInputManager.CurrentInput.CameraZoom();
 }
Example #5
0
 public void InitState(ref CameraMovementJobState CameraMovementJobState)
 {
     CameraMovementJobState.CameraZoomState.TargetSize = MainCamera.orthographicSize;
 }
Example #6
0
 public void SetupJob(ref CameraMovementJobState CameraMovementJobState)
 {
     CameraMovementJobState.CameraPanningState.ScreenMovementIntensity = this.CameraMovementConfiguration.CameraPanningComponent.ScreenMovementIntensity;
     CameraMovementJobState.CameraPanningState.DampingSpeed            = this.CameraMovementConfiguration.CameraPanningComponent.DampingSpeed;
 }
Example #7
0
 public void SetCameraMovementJobState(CameraMovementJobState CameraMovementJobState)
 {
     this.CameraMovementJobState[0] = CameraMovementJobState;
 }
Example #8
0
 public void SetupJob(ref CameraMovementJobState CameraMovementJobState)
 {
     CameraMovementJobState.CameraVerticalRotationState.MinAngle     = this.CameraMovementConfiguration.CameraVerticalRotationComponent.MinAngle;
     CameraMovementJobState.CameraVerticalRotationState.MaxAngle     = this.CameraMovementConfiguration.CameraVerticalRotationComponent.MaxAngle;
     CameraMovementJobState.CameraVerticalRotationState.DampingSpeed = this.CameraMovementConfiguration.CameraVerticalRotationComponent.DampingSpeed;
 }
Example #9
0
 public void InitState(ref CameraMovementJobState CameraMovementJobState)
 {
     CameraMovementJobState.CameraVerticalRotationState.CurrentDeltaAngle = 0f;
 }
Example #10
0
 public void SetupJob(ref CameraMovementJobState CameraMovementJobState)
 {
     CameraMovementJobState.CameraOrientationState.IsRotating             = this.gameInputManager.CurrentInput.RotationCameraDH();
     CameraMovementJobState.CameraOrientationState.LeftRotationFromInput  = gameInputManager.CurrentInput.LeftRotationCamera();
     CameraMovementJobState.CameraOrientationState.RightRotationFromInput = gameInputManager.CurrentInput.RightRotationCamera();
 }