/// <summary>
 /// Switches camera mode to full view of given camera
 /// </summary>
 /// <param name="fullCameraViewToSwitch"></param>
 public void SwitchToFull(FullCameraView fullCameraViewToSwitch)
 {
     fullCameraView = fullCameraViewToSwitch;
     cameraViewMode = CameraViewMode.Full;
     uiCanvas.SetActive(false);
     UpdateCameras();
 }
 /// <summary>
 /// Snap a given camera to the position of another
 /// </summary>
 /// <param name="cameraToSyncTo"></param>
 public void SyncCameraPositions(FullCameraView cameraToSyncTo, bool doLerp = false, float lerpTime = 1.0f)
 {
     if (cameraToSyncTo == FullCameraView.PlayerOneView)
     {
         if (!doLerp)
         {
             playerTwoCamera.transform.position = playerOneCamera.transform.position;
             playerTwoCamera.transform.rotation = playerOneCamera.transform.rotation;
         }
         else
         {
             StartCoroutine(LerpCamera(FullCameraView.PlayerTwoView, playerOneCamera.transform.position, lerpTime));
         }
     }
     else
     {
         if (!doLerp)
         {
             playerOneCamera.transform.position = playerTwoCamera.transform.position;
             playerOneCamera.transform.rotation = playerTwoCamera.transform.rotation;
         }
         else
         {
             StartCoroutine(LerpCamera(FullCameraView.PlayerOneView, playerTwoCamera.transform.position, lerpTime));
         }
     }
 }
 /// <summary>
 /// Public method to allow for easy camera mode toggling
 /// </summary>
 /// <param name="fullCameraViewToSwitch"></param>
 public void ToggleCameraMode(FullCameraView fullCameraViewToSwitch = FullCameraView.PlayerOneView)
 {
     if (cameraViewMode == CameraViewMode.Full)
     {
         SwitchToSplit();
     }
     else
     {
         SwitchToFull(fullCameraViewToSwitch);
     }
 }
    /// <summary>
    /// Given a camera and a destination, the camera will be lerped to the destination over a given time
    /// </summary>
    /// <param name="cameraViewToLerp"></param>
    /// <param name="destination"></param>
    /// <param name="lerpTime"></param>
    /// <returns></returns>
    private IEnumerator LerpCamera(FullCameraView cameraViewToLerp, Vector3 destination, float lerpTime)
    {
        GameObject cameraToLerp;
        float      t = 0;

        if (cameraViewToLerp == FullCameraView.PlayerOneView)
        {
            cameraToLerp = playerOneCamera.gameObject;
        }
        else
        {
            cameraToLerp = playerTwoCamera.gameObject;
        }

        while ((destination - cameraToLerp.transform.position).magnitude > 0.01)
        {
            t += Time.deltaTime / lerpTime;
            cameraToLerp.transform.position = Vector3.Lerp(cameraToLerp.transform.position, destination, t);
            yield return(null);
        }

        cameraToLerp.transform.position = destination;
    }