void OnAudio(IAudioEvent2D e) { for (int i = head; i != tail; i = (i+1) % MaxPending) { if (pending [i].audio.name.Equals (e.audio.name)) { return; } } pending [tail] = e; tail = (tail + 1) % MaxPending; }
void OnAudio(IAudioEvent2D e) { for (int i = head; i != tail; i = (i + 1) % MaxPending) { if (pending [i].audio.name.Equals(e.audio.name)) { return; } } pending [tail] = e; tail = (tail + 1) % MaxPending; }
void OnAudio(IAudioEvent2D e) { // Do not add duplicate events. Prevents situation where the same // audio clips are played in parallel increasing the effects volume. for (int i = head; i != tail; i = (i + 1) % MaxPending) { if (pending[i].Audio.name.Equals(e.Audio.name)) { return; } } pending[tail] = e; tail = (tail + 1) % MaxPending; }