public void ToggleUI() { switch (currentCameraState) { case CurrentCameraState.CameraStateBack: { currentCameraState = CurrentCameraState.CameraStateUp; this.requiredCameraTransformPosition = CameraTopTransform.localPosition; this.previousCameraTransformPosition = CameraBackTransform.localPosition; this.requiredCameraRotation = CameraTopTransform.rotation; this.previosCameraRotation = CameraBackTransform.rotation; break; } case CurrentCameraState.CameraStateUp: { currentCameraState = CurrentCameraState.CameraStateBack; this.requiredCameraTransformPosition = CameraBackTransform.localPosition; this.previousCameraTransformPosition = CameraTopTransform.localPosition; this.requiredCameraRotation = CameraBackTransform.rotation; this.previosCameraRotation = CameraTopTransform.rotation; break; } default: break; } }
public void ToggleUI() { switch (currentCameraState) { case CurrentCameraState.CameraStateSide: { currentCameraState = CurrentCameraState.CameraStateBack; this.requiredCameraTransformPosition = this.cameraBackTransformPosition; this.previousCameraTransformPosition = this.cameraSideTransformPosition; this.requiredCameraRotation = kCameraBackRotationAngle; this.previosCameraRotation = kCameraSideRotationAngle; break; } case CurrentCameraState.CameraStateBack: { currentCameraState = CurrentCameraState.CameraStateUp; this.requiredCameraTransformPosition = this.cameraTopTransformPosition; this.previousCameraTransformPosition = this.cameraBackTransformPosition; this.requiredCameraRotation = kCameraTopRotationAngle; this.previosCameraRotation = kCameraBackRotationAngle; break; } case CurrentCameraState.CameraStateUp: { currentCameraState = CurrentCameraState.CameraStateSide; this.requiredCameraTransformPosition = this.cameraSideTransformPosition; this.previousCameraTransformPosition = this.cameraTopTransformPosition; this.requiredCameraRotation = kCameraSideRotationAngle; this.previosCameraRotation = kCameraTopRotationAngle; break; } default: break; } this.cameraInterpolationStartTime = Time.time; this.cameraPositionJourneyLength = Vector3.Distance(previousCameraTransformPosition, requiredCameraTransformPosition); this.cameraRotationJourneyLength = Vector3.Distance(previosCameraRotation, requiredCameraRotation); }
// Use this for initialization private void Start() { currentCameraState = CurrentCameraState.CameraStateBack; }
private void UpdateCameraState(CritterEditorInputManager critterEditorInputManager) { // CAMERA: // Determine Camera Mode: if (altIsDown) { currentCameraState = CurrentCameraState.Static; // default if (mouseMiddleIsDown) { // PAN currentCameraState = CurrentCameraState.Pan; } if (mouseLeftIsDown) { // Rotate: currentCameraState = CurrentCameraState.Rotate; } if (mouseRightIsDown) { // Zoom: currentCameraState = CurrentCameraState.Zoom; } critterEditorUI.buttonDisplayCameraMode.interactable = false; if (isSegmentHover) { hoverSegment.GetComponent<MeshRenderer>().material.SetFloat("_DisplayTarget", 0f); // turn on selected vis } } else { // not in camera mode: currentCameraState = CurrentCameraState.Off; if (mouseMiddleIsDown) { // middle w/e } if (mouseLeftIsDown) { // Left-Click: // Check For Selecting } if (mouseRightIsDown) { // Right-Click: } critterEditorUI.buttonDisplayCameraMode.interactable = true; } critterEditorInputManager.critterConstructorCameraController.UpdateCamera(this); // pan, zoom, rotate, or do nothing UpdateGizmos(); }
// Use this for initialization private void Awake() { currentCameraState = CurrentCameraState.CameraStateSide; this.cameraSideTransformPosition = new Vector3(16, 10, -20); this.cameraBackTransformPosition = new Vector3(-7, 10, -2); this.cameraTopTransformPosition = new Vector3(16, 33, -2); }