From 8d985fe169e2e6c0d4bce358488a6913388469fb Mon Sep 17 00:00:00 2001 From: Nick Date: Sat, 18 Mar 2023 17:38:55 -0400 Subject: [PATCH] Fixed coroutine --- .../Components/Volumes/LoadCreditsVolume.cs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/NewHorizons/Components/Volumes/LoadCreditsVolume.cs b/NewHorizons/Components/Volumes/LoadCreditsVolume.cs index acd07eeb..dd2d83ee 100644 --- a/NewHorizons/Components/Volumes/LoadCreditsVolume.cs +++ b/NewHorizons/Components/Volumes/LoadCreditsVolume.cs @@ -2,6 +2,7 @@ using NewHorizons.External.Modules; using NewHorizons.Handlers; using System.Collections; using UnityEngine; +using Logger = NewHorizons.Utility.Logger; namespace NewHorizons.Components.Volumes { @@ -25,7 +26,8 @@ namespace NewHorizons.Components.Volumes { if (hitObj.CompareTag("PlayerDetector") && enabled) { - StartCoroutine(GameOver()); + // Have to run it off the mod behaviour since the game over controller disables everything + Main.Instance.StartCoroutine(GameOver()); } } @@ -36,6 +38,9 @@ namespace NewHorizons.Components.Volumes Locator.GetPromptManager().SetPromptsVisible(false); Locator.GetPauseCommandListener().AddPauseCommandLock(); + // The PlayerCameraEffectController is what actually kills us, so convince it we're already dead + Locator.GetDeathManager()._isDead = true; + _playerCameraEffectController.OnPlayerDeath(deathType); yield return new WaitForSeconds(_playerCameraEffectController._deathFadeLength); @@ -49,13 +54,9 @@ namespace NewHorizons.Components.Volumes _gameOverController._loading = true; yield return new WaitUntil(ReadytoLoadCreditsScene); + } - LoadCreditsScene(); - } - else - { - LoadCreditsScene(); - } + LoadCreditsScene(); } private bool ReadytoLoadCreditsScene() => _gameOverController._fadedOutText && _gameOverController._textAnimator.IsComplete(); @@ -64,6 +65,8 @@ namespace NewHorizons.Components.Volumes private void LoadCreditsScene() { + Logger.LogVerbose($"Load credits {creditsType}"); + switch (creditsType) { case VolumesModule.LoadCreditsVolumeInfo.CreditsType.Fast: