Merge branch 'main' into dev

This commit is contained in:
xen-42 2024-06-10 18:53:23 -04:00 committed by GitHub
commit 67590c5176
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 2 deletions

View File

@ -5,6 +5,10 @@ using UnityEngine;
namespace NewHorizons.Handlers namespace NewHorizons.Handlers
{ {
/// <summary>
/// copied from LoadManager.
/// exists so we can do things after the fade without patching.
/// </summary>
public static class FadeHandler public static class FadeHandler
{ {
public static void FadeOut(float length) => Delay.StartCoroutine(FadeOutCoroutine(length)); public static void FadeOut(float length) => Delay.StartCoroutine(FadeOutCoroutine(length));
@ -17,11 +21,14 @@ namespace NewHorizons.Handlers
while (Time.unscaledTime < endTime) while (Time.unscaledTime < endTime)
{ {
LoadManager.s_instance._fadeImage.color = Color.Lerp(Color.clear, Color.black, (Time.unscaledTime - startTime) / length); var t = Mathf.Clamp01((Time.unscaledTime - startTime) / length);
LoadManager.s_instance._fadeImage.color = Color.Lerp(Color.clear, Color.black, t);
AudioListener.volume = 1f - t;
yield return new WaitForEndOfFrame(); yield return new WaitForEndOfFrame();
} }
LoadManager.s_instance._fadeImage.color = Color.black; LoadManager.s_instance._fadeImage.color = Color.black;
AudioListener.volume = 0;
yield return new WaitForEndOfFrame(); yield return new WaitForEndOfFrame();
} }

View File

@ -981,11 +981,11 @@ namespace NewHorizons
OWInput.ChangeInputMode(InputMode.None); OWInput.ChangeInputMode(InputMode.None);
// Hide unloading // Hide unloading
ManualOnStartSceneLoad(sceneToLoad);
FadeHandler.FadeThen(1f, () => FadeHandler.FadeThen(1f, () =>
{ {
// 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); // putting it before fade breaks ship warp effect cuz pause
LoadManager.LoadSceneImmediate(sceneToLoad); LoadManager.LoadSceneImmediate(sceneToLoad);
}); });
} }