public void EnableFreeformCamera(bool flag) { if (flag) { Main.Logger.LogDebug($"[BTDebug] Turning Freeform Camera is ON"); originalCameraFoV = Camera.fieldOfView; originalCameraFarClipPlane = Camera.farClipPlane; Camera.fieldOfView = 60; Camera.farClipPlane = 9999; CameraControl.DEBUG_TakeCompleteControl = true; CameraControl.enabled = false; if (!FreeFormCamera) { FreeFormCamera = GameCameraObject.AddComponent <FreeFormCamera>(); } FreeFormCamera.enabled = true; IsFreeformCameraEnabled = true; } else { Main.Logger.LogDebug($"[BTDebug] Turning Freeform Camera is OFF"); CameraControl.enabled = true; CameraControl.DEBUG_TakeCompleteControl = false; Camera.fieldOfView = originalCameraFoV; Camera.farClipPlane = originalCameraFarClipPlane; if (FreeFormCamera) { FreeFormCamera.enabled = false; } IsFreeformCameraEnabled = false; } }
private bool SetupCamera() { if (!GameCameraObject) { GameCameraObject = GameObject.Find(CombatGameCameraGOName); if (GameCameraObject == null) { IsInSimGame = true; if (UnityGameInstance.BattleTechGame.Simulation.CurRoomState == DropshipLocation.SHIP) { GameCameraObject = GameObject.Find(SpaceCameraGOName); } else { GameCameraObject = GameObject.Find(SimGameCameraGOName); } } else { IsInSimGame = false; } if (!GameCameraObject) { return(false); } if (!IsInSimGame) { CameraControl = GameCameraObject.GetComponent <CameraControl>(); if (!CameraControl) { return(false); } DebugFlyCameraControl = GameCameraObject.GetComponent <DebugFlyCameraControl>(); if (!DebugFlyCameraControl) { return(false); } } Camera = GameCameraObject.GetComponentInChildren <Camera>(); if (!Camera) { return(false); } } return(true); }
public void EnableFreeformCamera(bool flag) { if (flag) { Main.Logger.LogDebug($"[BTDebug] Turning Freeform Camera is ON"); originalCameraFoV = Camera.fieldOfView; originalCameraFarClipPlane = Camera.farClipPlane; Camera.fieldOfView = 60; Camera.farClipPlane = 9999; if (!IsInSimGame) { CameraControl.DEBUG_TakeCompleteControl = true; } if (!FreeFormCamera) { FreeFormCamera = GameCameraObject.AddComponent <FreeFormCamera>(); } FreeFormCamera.enabled = true; IsFreeformCameraEnabled = true; } else { Main.Logger.LogDebug($"[BTDebug] Turning Freeform Camera is OFF"); if (!IsInSimGame) { CameraControl.DEBUG_TakeCompleteControl = false; } Camera.fieldOfView = originalCameraFoV; Camera.farClipPlane = originalCameraFarClipPlane; if (FreeFormCamera) { FreeFormCamera.enabled = false; MonoBehaviour.Destroy(FreeFormCamera); } IsFreeformCameraEnabled = false; // Reset GOs GameCameraObject = null; CameraControl = null; Camera = null; DebugFlyCameraControl = null; FreeFormCamera = null; } }
private bool SetupCamera() { if (!GameCameraObject) { GameCameraObject = GameObject.Find(CombatGameCameraGOName); if (!GameCameraObject) { return(false); } CameraControl = GameCameraObject.GetComponent <CameraControl>(); if (!CameraControl) { return(false); } Camera = GameCameraObject.GetComponentInChildren <Camera>(); if (!Camera) { return(false); } } return(true); }