public void SetAngle(float angle) { GameManager.CameraMode mode = GameManager.instance.GetCameraMode(); if (mode != GameManager.CameraMode.AUTO) { return; } if (angle != pendingAngle) { this.pendingAngle = angle; StartFadingOut(); } }
void LateUpdate() { GameManager.CameraMode mode = GameManager.instance.GetCameraMode(); bool topDownInput = Input.GetAxis("TopDown") > 0.5f; // If the camera mode is MANUAL, The player can just "Look at Player" then pivot to the top to achieve this if (mode == GameManager.CameraMode.SEMI_AUTO && canChangeTopDown && topDownInput) { pendingTopDownMode = !topDownMode; canChangeTopDown = false; if (pendingTopDownMode) { pendingPitch = 85; } else { pendingPitch = 30; } StartFadingOut(); } if (!topDownInput) { canChangeTopDown = true; } bool lookAtPlayerInput = Input.GetAxis("LookAtPlayer") < -0.5f; // Player can't hit any buttons to change the Camera. That is one of the guarentees of AUTO cam mode if (mode == GameManager.CameraMode.MANUAL && canChangePlayerLook && lookAtPlayerInput) { pendingLookAtPlayer = !lookAtPlayer; canChangePlayerLook = false; StartFadingOut(); } if (!lookAtPlayerInput) { canChangePlayerLook = true; } switch (mode) { case GameManager.CameraMode.AUTO: AutoCamera(); break; case GameManager.CameraMode.SEMI_AUTO: SemiAutoCamera(); break; case GameManager.CameraMode.MANUAL: ManualCamera(); break; } if (Input.GetButton("Help")) { helpMenu.SetActive(true); } else { helpMenu.SetActive(false); } //transform.LookAt(target.transform.position, Vector3.up); //Vector3 target = new Vector3(target.transform.position.x, 0, target.transform.position.z); //transform.position = target - (rotation * new Vector3(0f, 0f, followDistance)); //transform.LookAt(target, Vector3.up); }