void FixedUpdate() { for (int i = 0; i < sfxInstanceList.Count; i++) { SfxInstance inst = sfxInstanceList[i]; if (!inst.sfxSrc.isPlaying && !inst.isPaused) { sfxInstanceList.Remove(inst); i--; inst.sfxSrc.clip = null; inst.sfxSrc.loop = false; inst.sfxSrc.volume = 1; sfxSrcQueue.Enqueue(inst.sfxSrc); } } //Check if the current background clip is still playing if (!masterSrc.isPlaying && sourceToClipDict.ContainsKey(masterSrc)) { int obsoleteId = sourceToClipDict[masterSrc]; sourceToClipDict.Remove(masterSrc); clipToSourceDict.Remove(obsoleteId); clipIdPool.Enqueue(obsoleteId); } }
public void Remove() { Buff.OnRemove(this); if (Target != null) { Target.BuffEvents.Trigger(EventFlag.LOSE_BUFF, this); Target.Buffs.Remove(this); RemoveMods(); } if (SfxInstance != null) { SfxInstance.Despawn(); } }
void FixedUpdate() { for (int i = 0; i < sfxInstanceList.Count; i++) { SfxInstance inst = sfxInstanceList[i]; if (!inst.sfxSrc.isPlaying && !inst.isPaused) { sfxInstanceList.Remove(inst); i--; inst.sfxSrc.clip = null; inst.sfxSrc.loop = false; inst.sfxSrc.volume = 1; sfxSrcQueue.Enqueue(inst.sfxSrc); } } }