public void PlayRawSound(string soundPath, float volume = 1f) { //Retrieve next sound holder, then assign the sound ID to the holder SoundHolder holder = NextAvailableSound(); holder.SetSound(soundPath, true); holder.SetVolume(volume); //Play the sound holder.Play(); UpdateLastSoundTimer(); }
public void PlaySound(Sound sound, float volume = 1f) { if (SoundMap.ContainsKey(sound) == false) { Debug.LogError($"Cannot play sound {sound} because it doesn't exist in {nameof(SoundMap)}!"); return; } //Retrieve next sound holder, then assign the sound ID to the holder SoundHolder holder = NextAvailableSound(); holder.SetSound(sound); holder.SetVolume(volume); //Play the sound holder.Play(); UpdateLastSoundTimer(); }