예제 #1
0
 private void SetCurrentCameraRotationEnum(DesiredRotation d)
 {
     Debug.Log($"Previous Camera Rotation: {currentCameraRotation}, Desired Rotation: {d}");
     if (currentCameraRotation == CameraRotation.left_back)
     {
         if (d == DesiredRotation.right)
         {
             currentCameraRotation = CameraRotation.left_front;
         }
         else
         {
             currentCameraRotation = CameraRotation.right_back;
         }
     }
     if (currentCameraRotation == CameraRotation.left_front)
     {
         if (d == DesiredRotation.right)
         {
             currentCameraRotation = CameraRotation.right_front;
         }
         else
         {
             currentCameraRotation = CameraRotation.left_back;
         }
     }
     if (currentCameraRotation == CameraRotation.right_front)
     {
         if (d == DesiredRotation.right)
         {
             currentCameraRotation = CameraRotation.right_back;
         }
         else
         {
             currentCameraRotation = CameraRotation.left_front;
         }
     }
     if (currentCameraRotation == CameraRotation.right_back)
     {
         if (d == DesiredRotation.right)
         {
             currentCameraRotation = CameraRotation.left_back;
         }
         else
         {
             currentCameraRotation = CameraRotation.right_front;
         }
     }
     Debug.Log($"Next Camera Rotation: {currentCameraRotation}, Desired Rotation: {d}");
 }
예제 #2
0
    private void RotateCamera(DesiredRotation desiredRotation)
    {
        switch (desiredRotation)
        {
        case DesiredRotation.left:
            Camera.main.transform.parent.eulerAngles = new Vector3(Camera.main.transform.parent.eulerAngles.x, Mathf.RoundToInt(Camera.main.transform.parent.eulerAngles.y - 90), Camera.main.transform.parent.eulerAngles.z);
            SetCurrentCameraRotationEnum(desiredRotation);
            DisplayWalls();
            break;

        case DesiredRotation.right:
            Camera.main.transform.parent.eulerAngles = new Vector3(Camera.main.transform.parent.eulerAngles.x, Camera.main.transform.parent.eulerAngles.y + 90, Camera.main.transform.parent.eulerAngles.z);
            SetCurrentCameraRotationEnum(desiredRotation);
            DisplayWalls();
            break;
        }
    }