Пример #1
0
 /// <summary>
 /// Used for transferring the working variable set from one camera to another when using the CameraModeModule.
 /// This prevents the camera from jumping around when the modes get swapped
 /// </summary>
 /// <param name="other">The camera to copy from</param>
 public void TransferCameraTransforms(ManagementCamera other)
 {
     workingDesiredPosition           = other.workingDesiredPosition;
     workingDesiredRotationHorizontal = other.workingDesiredRotationHorizontal;
     workingDesiredRotationVertical   = other.workingDesiredRotationVertical;
     workingLastHeight = other.workingLastHeight;
 }
Пример #2
0
        /// <summary>
        /// Handler for SwapCamera from PlayerInput
        /// </summary>
        /// <param name="context">Holds bool regarding performed or cancelled</param>
        public void OnInput_SwapCamera(InputAction.CallbackContext context)
        {
            if (context.performed && cameraModes.Length > 0)
            {
                ManagementCamera curr = cameraModes[selectedCamera];

                selectedCamera++;
                if (selectedCamera >= cameraModes.Length)
                {
                    selectedCamera = 0;
                }

                ManagementCamera next = cameraModes[selectedCamera];

                next.TransferCameraTransforms(curr);
                curr.enabled = false;
                next.enabled = true;
            }
        }