From bddcd88b1665ee07aef98c7adab8b1ae3fe86b68 Mon Sep 17 00:00:00 2001 From: Nick Date: Tue, 4 Jun 2024 01:08:28 -0400 Subject: [PATCH] Don't just cut to black --- NewHorizons/Handlers/FadeHandler.cs | 6 ++++-- NewHorizons/Main.cs | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/NewHorizons/Handlers/FadeHandler.cs b/NewHorizons/Handlers/FadeHandler.cs index fbaa0b5b..ded72444 100644 --- a/NewHorizons/Handlers/FadeHandler.cs +++ b/NewHorizons/Handlers/FadeHandler.cs @@ -25,12 +25,14 @@ namespace NewHorizons.Handlers yield return new WaitForEndOfFrame(); } - public static void FadeThen(float length, Action action) => Delay.StartCoroutine(FadeThenCoroutine(length, action)); + public static void FadeThen(float length, float totalTime, Action action) => Delay.StartCoroutine(FadeThenCoroutine(length, totalTime, action)); - private static IEnumerator FadeThenCoroutine(float length, Action action) + private static IEnumerator FadeThenCoroutine(float length, float totalTime, Action action) { yield return FadeOutCoroutine(length); + yield return new WaitForSeconds(totalTime - length); + action?.Invoke(); } } diff --git a/NewHorizons/Main.cs b/NewHorizons/Main.cs index 7ca6e322..a90fabf2 100644 --- a/NewHorizons/Main.cs +++ b/NewHorizons/Main.cs @@ -970,11 +970,13 @@ namespace NewHorizons OWInput.ChangeInputMode(InputMode.None); // Hide unloading - ManualOnStartSceneLoad(sceneToLoad); - FadeHandler.FadeThen(1f, () => + // When warping with the ship or vessel there are graphical effects we want to see! Do not pause immediately or cut to black immediately + // Otherwise we fade to black much quicker. Still wait a bit for the sound effects to finish + FadeHandler.FadeThen(IsWarpingFromShip || IsWarpingFromVessel ? 1f : 0.2f, 1.2f, () => { // Slide reel unloading is tied to being removed from the sector, so we do that here to prevent a softlock Locator.GetPlayerSectorDetector().RemoveFromAllSectors(); + ManualOnStartSceneLoad(sceneToLoad); LoadManager.LoadSceneImmediate(sceneToLoad); }); }