/// <summary> /// Helper for immediately stopping and clearing out an entire list. /// </summary> /// <param name="list"></param> public static void ClearImmediate(List <AudioCue> list) { for (int i = 0; i < list.Count; ++i) { AudioCue cue = list[i]; cue.StopImmediate(); } list.Clear(); }
/// <summary> /// If anything(s) in the list are me (or descendent), /// Stop it and remove it from the list. /// </summary> /// <param name="list"></param> public virtual bool Stop(List <AudioCue> list) { bool stopped = false; for (int i = list.Count - 1; i >= 0; --i) { AudioCue cue = list[i]; Sound v = cue.Sound; if ((v != null) && v.BelongsTo(this)) { /// Stop v from playing cue.StopImmediate(); list.RemoveAt(i); stopped = true; } } return(stopped); }