/// <summary> /// Updates the robot camera view window /// </summary> private void UpdateCameraWindow() { //Can use robot view when dynamicCamera is active if (usingRobotView && main.DynamicCameraObject.activeSelf) { //Make sure there is camera on robot if (robotCameraManager.CurrentCamera != null) { robotCameraManager.CurrentCamera.SetActive(true); robotCameraManager.CurrentCamera.GetComponent <Camera>().targetTexture = robotCameraView; //Toggle the robot camera using Z (can be changed later) if (Input.GetKeyDown(KeyCode.Z)) { //Reset the targetTexture of current camera or they will conflict robotCameraManager.CurrentCamera.GetComponent <Camera>().targetTexture = null; robotCameraManager.ToggleCamera(); robotCameraManager.CurrentCamera.GetComponent <Camera>().targetTexture = robotCameraView; } } } //Free the target texture of the current camera when the window is closed (for normal toggle camera function) else { if (robotCameraManager.CurrentCamera != null) { robotCameraManager.CurrentCamera.GetComponent <Camera>().targetTexture = null; } } }
/// <summary> /// Updates the robot camera view window /// </summary> private void UpdateCameraWindow() { //Can use robot view when dynamicCamera is active if (usingRobotView && main.dynamicCameraObject.activeSelf) { //Debug.Log(robotCamera.CurrentCamera); //Make sure there is camera on robot if (robotCamera.CurrentCamera != null) { robotCamera.CurrentCamera.SetActive(true); robotCamera.CurrentCamera.GetComponent <Camera>().targetTexture = robotCameraView; //Toggle the robot camera using Q (should be changed later) if (Input.GetKeyDown(KeyCode.Q)) { robotCamera.CurrentCamera.GetComponent <Camera>().targetTexture = null; robotCamera.ToggleCamera(); robotCamera.CurrentCamera.GetComponent <Camera>().targetTexture = robotCameraView; } //Debug.Log("Robot camera view is " + robotCameraView.name); //Debug.Log(robotCamera.CurrentCamera); } } //Don't allow using robot view window when users are currently using one of the robot view else if (usingRobotView && !main.dynamicCameraObject.activeSelf) { UserMessageManager.Dispatch("You can only use robot view window when you are not in robot view mode!", 2f); usingRobotView = false; robotCameraViewWindow.SetActive(false); } //Free the target texture of the current camera when the window is closed (for normal toggle camera function) else { if (robotCamera.CurrentCamera != null) { robotCamera.CurrentCamera.GetComponent <Camera>().targetTexture = null; } } }