/// <summary> /// Stops all audio sources playing the provided audio clip. /// </summary> /// <param name="audioId">The audio ID to stop.</param> public static void Stop(AudioId audioId) { AudioEntry audioEntry = AudioEntries.Find(entry => entry.Id == audioId); if (audioEntry != null) { audioEntry.AudioSource.Stop(); } }
/// <summary> /// Gets the playing state for a given audio ID's audio source. /// </summary> /// <param name="id">The audio ID to match against.</param> /// <returns>Returns true if the audio source exists and is playing, otherwise false.</returns> public static bool IsPlaying(AudioId id) { return(AudioEntries.FirstOrDefault(entry => entry.Id == id)?.AudioSource.isPlaying ?? false); }