Fix no audio and eye closing effect

This commit is contained in:
xen-42 2025-02-14 21:25:10 -05:00
parent 1b1bf47266
commit 392fc404f4
4 changed files with 22 additions and 1 deletions

View File

@ -14,6 +14,7 @@ namespace NewHorizons.Builder.Volumes
volume.creditsType = info.creditsType;
volume.gameOverText = info.gameOverText;
volume.deathType = info.deathType == null ? null : EnumUtils.Parse(info.deathType.ToString(), DeathType.Default);
volume.colour = info.gameOverTextColour?.ToColor();
return volume;
}

View File

@ -15,6 +15,8 @@ namespace NewHorizons.Components.Volumes
public string gameOverText;
public DeathType? deathType = DeathType.Default;
public Color? colour;
private GameOverController _gameOverController;
private PlayerCameraEffectController _playerCameraEffectController;
@ -52,6 +54,8 @@ namespace NewHorizons.Components.Volumes
}
else
{
// Wake up relaxed next loop
PlayerData.SetLastDeathType(DeathType.Meditation);
FadeHandler.FadeOut(fadeLength);
}
@ -62,6 +66,11 @@ namespace NewHorizons.Components.Volumes
_gameOverController._deathText.text = TranslationHandler.GetTranslation(gameOverText, TranslationHandler.TextType.UI);
_gameOverController.SetupGameOverScreen(5f);
if (colour != null)
{
_gameOverController._deathText.color = (Color)colour;
}
// Make sure the fade handler is off now
FadeHandler.FadeIn(0f);
@ -95,6 +104,8 @@ namespace NewHorizons.Components.Volumes
LoadManager.LoadScene(OWScene.Credits_Fast, LoadManager.FadeType.ToBlack);
break;
default:
// GameOverController disables post processing
_gameOverController._flashbackCamera.postProcessing.enabled = true;
GlobalMessenger.FireEvent("TriggerFlashback");
break;
}

View File

@ -1,3 +1,4 @@
using NewHorizons.External.SerializableData;
using NewHorizons.External.SerializableEnums;
using Newtonsoft.Json;
using System.ComponentModel;
@ -18,5 +19,10 @@ namespace NewHorizons.External.Modules.Volumes.VolumeInfos
/// The type of death the player will have if they enter this volume. Don't set to have the camera just fade out.
/// </summary>
[DefaultValue("default")] public NHDeathType? deathType = null;
/// <summary>
/// Change the colour of the game over text. Leave empty to use the default orange.
/// </summary>
public MColor gameOverTextColour;
}
}

View File

@ -41,10 +41,13 @@ namespace NewHorizons.Handlers
while (Time.unscaledTime < endTime)
{
LoadManager.s_instance._fadeImage.color = Color.Lerp(Color.black, Color.clear, (Time.unscaledTime - startTime) / length);
var t = Mathf.Clamp01((Time.unscaledTime - startTime) / length);
LoadManager.s_instance._fadeImage.color = Color.Lerp(Color.black, Color.clear, t);
AudioListener.volume = t;
yield return new WaitForEndOfFrame();
}
AudioListener.volume = 1;
LoadManager.s_instance._fadeCanvas.enabled = false;
LoadManager.s_instance._fadeImage.color = Color.clear;