public static void restore(int pos) { CameraKeyFrame cam = keyFrames[pos]; Cameras.MainCamera().transform.position = cam.m_StartPos; Cameras.MainCamera().transform.rotation = cam.m_StartRot; PointsOfView.UpdatePivotBasedOnCamera(); Cameras.SetOrthographicSize(cam.m_StartOrthographicSize); }
public static bool Prefix( ref Vector3 ___m_StartPos, ref Vector3 ___m_StartPivot, ref float ___m_StartOrthographicSize, ref Vector3 ___m_EndPos, ref Vector3 ___m_EndPivot, ref float ___m_EndOrthographicSize, ref Quaternion ___m_EndRot, ref float ___m_ElapsedSeconds, ref float ___m_TransitionSeconds, ref bool ___m_Slerping ) { if (CinemaCamera.Activated()) { if (ModdedCinemaCamera.keyFrames.Count == 0) { CameraInterpolate.Cancel(); return(false); } else if (ModdedCinemaCamera.keyFrames.Count < 2) { PopUpWarning.Display("You must add at least 2 keyframes to use the cinematic camera!"); CameraInterpolate.Cancel(); return(false); } ___m_ElapsedSeconds += Time.unscaledDeltaTime; float num = Mathf.Clamp01(___m_ElapsedSeconds / ___m_TransitionSeconds); Vector3 vector = ModdedCinemaCamera.PivotHandler.Interpolate(ModdedCinemaCamera.current_start, num); Vector3 normalized3 = ModdedCinemaCamera.InterpolateHandler.Interpolate(ModdedCinemaCamera.current_start, num).normalized; // testing smooth movement PointsOfView.m_Pivot = vector; Cameras.MainCamera().transform.position = vector + normalized3 * GameSettings.CamDistFromPivot(); Cameras.MainCamera().transform.LookAt(vector); Cameras.SetOrthographicSize(Mathf.SmoothStep(___m_StartOrthographicSize, ___m_EndOrthographicSize, num)); Bridge.RefreshZoomDependentVisibility(); if (Mathf.Approximately(num, 1f)) { ModdedCinemaCamera.current_start += 1; ModdedCinemaCamera.current_end += 1; if (ModdedCinemaCamera.current_end >= ModdedCinemaCamera.keyFrames.Count) { CameraInterpolate.Cancel(); } else { CameraKeyFrame target = ModdedCinemaCamera.keyFrames[ModdedCinemaCamera.current_end]; CameraInterpolate.SlerpTo( target.m_StartPivot, target.m_StartPos, target.m_StartRot, target.m_StartOrthographicSize, target.m_DurationSeconds, target.m_Ease ); } } CameraControl.RegisterTransformUpdate(); return(false); } return(true); }