//第一个是唯一ID,第二个是挂载的NPC ID, 第三个是是否已经执行过结束逻辑 public RtBufData rmBuff(int bufId, int npcId, bool endIsExe = false) { RtBufData buf = null; OnWork.TryGetValue(bufId, out buf); //去除管理 OnWork.Remove(bufId); //去除Npc上 ServerNPC npc = WarServerManager.Instance.npcMgr.GetNPCByUniqueID(npcId); npc.rmBuff(bufId); if (buf != null && endIsExe == false) { buf.OnEnd(); } return(buf); }
/// <summary> /// 删除所有NPC身上的BUFF /// </summary> /// <param name="npcId">Npc identifier.</param> public void rmAllBuff(int npcId) { //去除Npc上 ServerNPC npc = WarServerManager.Instance.npcMgr.GetNPCByUniqueID(npcId); List <int> buffArray = npc.getBuffList; int cnt = buffArray.Count; for (int i = 0; i < cnt; ++i) { int bufId = buffArray[i]; RtBufData buf = null; if (OnWork.TryGetValue(bufId, out buf)) { buf.OnEnd(); } //去除管理 OnWork.Remove(bufId); } npc.rmAllBuff(); }