//释放buff所占的资源,重新放入对象池 private void ReleaseBuff(Buff buff) { List <IBuffEffect> effs = buff.EffectList; for (int i = 0; i < effs.Count; i++) { IBuffEffect eff = effs[i]; BattleFactory.Singleton.GetBattleContext().ReleaseBuffEffect(eff); } }
public virtual IBuffEffect CreateBuffEffect(int effectID) { if (m_parent != null) { return(m_parent.CreateBuffEffect(effectID)); } IBuffEffect eff = m_resultPool.GetObjectFromPool(effectID) as IBuffEffect; if (eff != null) { return(eff); } IBuffEffectFactory f = null; if (m_effectFactory.TryGetValue(effectID, out f)) { return(f()); } return(null); }
public void AddBuffEffect(IBuffEffect effect) { m_effects.Add(effect); }
public void ReleaseBuffEffect(IBuffEffect eff) { eff.Reset(); m_effectPool.ReleaseObject(eff.ClassID, eff); }
public void AddBuff(int buffID, int sourceID, float modifyTimer, bool isServerSend) { BuffInfo info = GameTable.BuffTableAsset.Lookup(buffID); if (null == info) { return; } if (IsDisable(info)) { return; } float length = info.BuffDuration; if (length != 0) {//不是无限的 length += modifyTimer; } Buff buff = new Buff(buffID, !info.IsNotRemoveForDead, length, info.IsFirstWork, info.Period); foreach (var item in info.PropertyPercentList) { if (item != 0) { buff.IsCalcProperty = true; break; } } if (!buff.IsCalcProperty) { foreach (var item in info.PropertyValueList) { if (item != 0) { buff.IsCalcProperty = true; break; } } } //play effect BuffEffectInfo beInfo = GameTable.BuffEffectTableAsset.Lookup(info.BuffEffectID); if (beInfo != null && !string.IsNullOrEmpty(beInfo.EffectName)) { Vector3 offset = new Vector3(beInfo.OffsetX, beInfo.OffsetY, beInfo.OffsetZ); string bone = beInfo.PlayBoneT; if (beInfo.IsSpecialPoint) { if (m_target.Type == ActorType.enNPC) { NPC npc = m_target as NPC; if (npc.GetNpcType() == ENNpcType.enBOSSNPC) { bone = beInfo.SpecialPointBoneT; } } } MainGame.Singleton.StartCoroutine(Coroutine_Load(buff, beInfo.EffectName, 0, bone, beInfo.IsAdhered, offset)); } BuffList.Add(buff); foreach (var item in info.BuffResultList) { if (buff.IsExsit(item.ID)) {//buff中不能存在多个相同的IBuffEffect continue; } IBuffEffect buffEffect = BattleFactory.Singleton.GetBattleContext().CreateBuffEffect(item.ID); if (null == buffEffect) { continue; } buffEffect.TargetID = m_target.ID; buffEffect.SourceID = sourceID; buffEffect.BuffID = buffID; buffEffect.BuffEffectID = info.BuffEffectID; buff.AddBuffEffect(buffEffect); buffEffect.OnGetBuffEffect(); } buff.UpdateFastFilterFlag(); if (buff.IsCalcProperty && !isServerSend) { BuffResult(); } else { RefreshBuffGraphics(); } }