IEnumerator TransitionInCamera() { myFreeLookCameraState = FreeLookCameraState.TransitionIn; float timer = 0f; xAxisMomentum = -360f; float startingOrtho = 160f; float destinationOrtho = 60f; Camera.main.orthographicSize = startingOrtho; myCinemachineFreeLook.m_Lens.OrthographicSize = startingOrtho; while (timer < 1f) { timer += Time.deltaTime; myCinemachineFreeLook.m_XAxis.Value += xAxisMomentum * Time.deltaTime; myCinemachineFreeLook.m_Lens.OrthographicSize = Mathf.Lerp( startingOrtho, destinationOrtho, timer); yield return(new WaitForEndOfFrame()); } myCinemachineFreeLook.m_Lens.OrthographicSize = destinationOrtho; myFreeLookCameraState = FreeLookCameraState.FreeLook; }
private void Awake() { myCinemachineFreeLook = GetComponent <CinemachineFreeLook>(); myFreeLookCameraState = FreeLookCameraState.FreeLook; }