/// <summary> /// 销毁所有闲置中的多通道音效的音源 /// </summary> public void ClearIdleMultipleAudioSource() { for (int i = 0; i < MultipleAudios.Count; i++) { if (!MultipleAudios[i].isPlaying) { AudioSource audio = MultipleAudios[i]; MultipleAudios.RemoveAt(i); i -= 1; Main.Kill(audio.gameObject); } } }
//提取闲置中的多通道音源 private AudioSource ExtractIdleMultipleAudioSource() { for (int i = 0; i < MultipleAudios.Count; i++) { if (!MultipleAudios[i].isPlaying) { return(MultipleAudios[i]); } } AudioSource audio = AudioToolkit.CreateAudioSource("MultipleAudio", MultiplePriority, MultipleVolume, 1, 0, Mute, Module.transform); MultipleAudios.Add(audio); return(audio); }