Fixed some errors

This commit is contained in:
Jenny Crowe 2022-03-07 02:41:07 -07:00
parent dd3bdaf87c
commit 1d564b4910
2 changed files with 7 additions and 0 deletions

View file

@ -230,6 +230,7 @@ namespace RhythmHeavenMania
public void Pause() public void Pause()
{ {
Conductor.instance.Pause(); Conductor.instance.Pause();
KillAllSounds();
} }
public void Stop(float beat) public void Stop(float beat)
@ -244,6 +245,8 @@ namespace RhythmHeavenMania
{ {
for (int i = 0; i < SoundObjects.Count; i++) for (int i = 0; i < SoundObjects.Count; i++)
Destroy(SoundObjects[i].gameObject); Destroy(SoundObjects[i].gameObject);
SoundObjects.Clear();
} }
#endregion #endregion

View file

@ -109,6 +109,10 @@ namespace RhythmHeavenMania.Util
public static void KillLoop(AudioSource source, float fadeTime) public static void KillLoop(AudioSource source, float fadeTime)
{ {
// Safeguard against previously-destroyed sounds.
if (source == null)
return;
source.GetComponent<Sound>().KillLoop(fadeTime); source.GetComponent<Sound>().KillLoop(fadeTime);
} }
} }