Removed audio fade in feature that wasn't working

This commit is contained in:
josshmot 2025-04-05 12:18:08 +10:00
parent 5cf7c18a51
commit 8fcf7d3031
2 changed files with 5 additions and 13 deletions

View File

@ -153,9 +153,8 @@ namespace NewHorizons.Components
completeCreditsLoad = (fromScene, toScene) => completeCreditsLoad = (fromScene, toScene) =>
{ {
// Patch new music // Patch new music clip
var musicSource = Locator.FindObjectsOfType<OWAudioSource>().Where(x => x.name == "AudioSource").Single(); var musicSource = Locator.FindObjectsOfType<OWAudioSource>().Where(x => x.name == "AudioSource").Single();
musicSource.Stop();
if (mod is not null) if (mod is not null)
{ {
AudioUtilities.SetAudioClip(musicSource, gameOver.audio, mod); AudioUtilities.SetAudioClip(musicSource, gameOver.audio, mod);
@ -164,10 +163,10 @@ namespace NewHorizons.Components
{ {
// We can't load in custom music if an IModBehaviour cannot be provided. This should only happen if called via TryHijackDeathSequence(). // We can't load in custom music if an IModBehaviour cannot be provided. This should only happen if called via TryHijackDeathSequence().
NHLogger.LogWarning("Credits called using TryHijackDeathSequence(), custom credits audio cannot not be loaded."); NHLogger.LogWarning("Credits called using TryHijackDeathSequence(), custom credits audio cannot not be loaded.");
return;
} }
musicSource.SetMaxVolume(gameOver.audioVolume);
musicSource.loop = gameOver.audioLooping; musicSource.loop = gameOver.audioLooping;
musicSource.FadeIn(gameOver.audioFadeInLength); musicSource._maxSourceVolume = gameOver.audioVolume;
// Janky wait until credits are built // Janky wait until credits are built
Task.Run( () => Task.Run( () =>
@ -176,11 +175,11 @@ namespace NewHorizons.Components
while (Locator.FindObjectsOfType<CreditsScrollSection>().Length == 0) { while (Locator.FindObjectsOfType<CreditsScrollSection>().Length == 0) {
if (Time.time > startTime + 0.1f) if (Time.time > startTime + 0.1f)
{ {
NHLogger.LogError("Timeout while waiting for credits to be built. Scroll duration couldn't be changed."); NHLogger.LogError("Timeout while waiting for credits to be built. Scroll duration won't be changed.");
return; return;
} }
} }
// Patch scroll duration // Patch scroll duration
var creditsScroll = Locator.FindObjectOfType<CreditsScrollSection>(); var creditsScroll = Locator.FindObjectOfType<CreditsScrollSection>();
creditsScroll._scrollDuration = gameOver.length; creditsScroll._scrollDuration = gameOver.length;

View File

@ -45,13 +45,6 @@ namespace NewHorizons.External.Modules
[DefaultValue(false)] [DefaultValue(false)]
public bool audioLooping; public bool audioLooping;
/// <summary>
/// Length of the credits music fade in.
/// Note: only applies when creditsType is set to "custom".
/// </summary>
[DefaultValue(0f)]
public float audioFadeInLength;
/// <summary> /// <summary>
/// Duration of the credits scroll in seconds. /// Duration of the credits scroll in seconds.
/// Note: only applies when creditsType is set to "custom". /// Note: only applies when creditsType is set to "custom".