public async void PlayAudioNotReplace(string clipName) { AudioClip clip = await GetAudioClip(clipName); foreach (var channel in Channels) { if (channel.Value.Playing) { continue; } if (channel.Key <= 10) { continue; } channel.Value.PlayClip(clip); return; } int maxChannel = 11; foreach (var id in Channels.Keys) { if (id > maxChannel) { maxChannel = id; } } AudioChannel newChannel = GetChannel(maxChannel + 1); newChannel.PlayClip(clip); newChannel.Volume = volume; }
public async void PlayAudio(int channelId, string clipName) { AudioClip clip = await GetAudioClip(clipName); AudioChannel channel = GetChannel(channelId); channel.PlayClip(clip); //channel.Volume = volume; }