Added stop all Audio

This commit is contained in:
BOT Alex 2024-02-04 08:19:38 +01:00
parent d75a0c74a6
commit 3d1f783f19
1 changed files with 12 additions and 0 deletions

View File

@ -4,6 +4,7 @@ using System.Collections.Generic;
using System.Linq;
using Unity.VisualScripting;
using UnityEngine;
using static Unity.VisualScripting.Member;
public class AudioManager : MonoBehaviour
@ -93,6 +94,17 @@ public class AudioManager : MonoBehaviour
yield return new WaitForSecondsRealtime(0.05f);
}
}
public static void StopAllAudio()
{
foreach (SoundSource item in AliveSources)
{
item.source.Stop();
Destroy(item.source.gameObject);
}
AliveSources.Clear();
}
}
public class SoundSource