public void Play(IAudioSource sound, int priority) { Voice voice = null; for (var i = 1; i < voices.Length; i++) { if (!voices[i].IsPlaying) { voice = voices[i]; } } if (voice == null) { for (var i = 1; i < voices.Length; i++) { if (priority >= voices[i].Priority) { voice = voices[i]; } } } if (voice != null) { voice.Play(sound.GetStream(), priority); } }
public void PlayMusic(IAudioSource music) { voices[0].Play(music.GetStream(), 0); }