public CBuff CreateBuff(string rid, CEntity caster, CEntity target) { CBuff buff = this._gPool.Pop <CBuff>(); buff.OnCreate(this._battle, rid, caster, target); this._idToBuff[buff.rid] = buff; this._buffs.Add(buff); return(buff); }
internal void Update(UpdateContext context) { int count = this._buffs.Count; for (int i = 0; i < count; i++) { CBuff buff = this._buffs[i]; buff.OnUpdate(context); } //清理CBuff this.DestroyBuffs(); }
private void DestroyBuffs() { int count = this._buffs.Count; for (int i = 0; i < count; i++) { CBuff buff = this._buffs[i]; if (!buff.markToDestroy) { continue; } buff.OnDestroy(); this._buffs.RemoveAt(i); this._idToBuff.Remove(buff.rid); this._gPool.Push(buff); --i; --count; } }
public void HandleBuffDestroied(string buffId) { CBuff buff = this._buffManager.GetBuff(buffId); buff.MarkToDestroy(); }