From b2d140a47e34b6b91661e8385df8f2b8a1fd23da Mon Sep 17 00:00:00 2001 From: Vivero Date: Tue, 19 May 2020 15:35:43 -0700 Subject: [PATCH] allow quicker camera transitions for certain scenarios --- KerbalVR_Mod/KerbalVR/KerbalVR_Scene.cs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/KerbalVR_Mod/KerbalVR/KerbalVR_Scene.cs b/KerbalVR_Mod/KerbalVR/KerbalVR_Scene.cs index ff1c7e85..4fc05a55 100644 --- a/KerbalVR_Mod/KerbalVR/KerbalVR_Scene.cs +++ b/KerbalVR_Mod/KerbalVR/KerbalVR_Scene.cs @@ -407,18 +407,18 @@ protected void UpdateCameraPositions() { } protected void OnGameSceneSwitchRequested(GameEvents.FromToAction fromToAction) { - StartCoroutine("TransitionScene"); + StartCoroutine(TransitionScene()); } protected void OnIvaCameraChange(Kerbal kerbal) { - StartCoroutine("TransitionScene"); + StartCoroutine(TransitionScene(true)); } protected void OnCameraChange(CameraManager.CameraMode mode) { #if DEBUG Utils.Log("OnCameraChange: " + mode.ToString()); #endif - StartCoroutine("TransitionScene"); + StartCoroutine(TransitionScene(true)); } protected void OnHmdStatusUpdated(bool isRunning) { @@ -426,10 +426,10 @@ protected void OnHmdStatusUpdated(bool isRunning) { if (isRunning) { BuildVrCameraRig(); } - StartCoroutine("TransitionScene"); + StartCoroutine(TransitionScene()); } - protected IEnumerator TransitionScene() { + protected IEnumerator TransitionScene(bool doFastTransition = false) { #if DEBUG Utils.Log("TransitionScene: started..."); #endif @@ -464,7 +464,12 @@ protected IEnumerator TransitionScene() { } // wait some time - yield return new WaitForSeconds(0.5f); + if (doFastTransition) { + yield return null; + } + else { + yield return new WaitForSeconds(0.5f); + } #if DEBUG Utils.Log("TransitionScene: set up new cameras..."); #endif