Don't just cut to black

This commit is contained in:
Nick 2024-06-04 01:08:28 -04:00
parent 0f56b59d63
commit bddcd88b16
2 changed files with 8 additions and 4 deletions

View File

@ -25,12 +25,14 @@ namespace NewHorizons.Handlers
yield return new WaitForEndOfFrame(); 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 FadeOutCoroutine(length);
yield return new WaitForSeconds(totalTime - length);
action?.Invoke(); action?.Invoke();
} }
} }

View File

@ -970,11 +970,13 @@ namespace NewHorizons
OWInput.ChangeInputMode(InputMode.None); OWInput.ChangeInputMode(InputMode.None);
// Hide unloading // Hide unloading
ManualOnStartSceneLoad(sceneToLoad); // When warping with the ship or vessel there are graphical effects we want to see! Do not pause immediately or cut to black immediately
FadeHandler.FadeThen(1f, () => // 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 // Slide reel unloading is tied to being removed from the sector, so we do that here to prevent a softlock
Locator.GetPlayerSectorDetector().RemoveFromAllSectors(); Locator.GetPlayerSectorDetector().RemoveFromAllSectors();
ManualOnStartSceneLoad(sceneToLoad);
LoadManager.LoadSceneImmediate(sceneToLoad); LoadManager.LoadSceneImmediate(sceneToLoad);
}); });
} }