void BuffLogic(int deltaTime, PlayerComponent playerComp) { for (int i = 0; i < playerComp.buffList.Count; i++) { BuffInfo bi = playerComp.buffList[i]; bi.buffTime += deltaTime; if (bi.BuffData.m_DamageNumber > 0) { bi.hitTime -= deltaTime; if (bi.hitTime < 0) { bi.hitTime = (int)(bi.BuffData.m_BuffEffectSpace * 1000); //伤害 if (playerComp.Entity.GetExistComp <LifeComponent>()) { LifeComponent lc = playerComp.Entity.GetComp <LifeComponent>(); SkillUtils.Damage(m_world, m_world.GetEntity(bi.creater), playerComp.Entity, bi.BuffData.m_DamageNumber); m_world.eventSystem.DispatchEvent(GameUtils.c_HitBuff, playerComp.Entity, bi); } } } if (bi.buffTime > bi.BuffData.m_BuffTime * 1000) { m_world.eventSystem.DispatchEvent(GameUtils.c_removeBuff, playerComp.Entity, bi); playerComp.buffList.RemoveAt(i); i--; } } }
public void Damage(EntityBase skiller, EntityBase hurter, SkillDataGenerate skillData) { bool isCrit = false; bool isDisrupting = false; int damageNumber = DamageValueFormula(skillData, skiller, hurter, out isCrit, out isDisrupting); if (damageNumber == 0) { return; } CampComponent acc = skiller.GetComp <CampComponent>(); CampComponent bcc = hurter.GetComp <CampComponent>(); //Debug.Log("Damage == " + damageNumber + " hurter " + hurter.ID + " acc " + acc.creater + " bcc " + bcc.creater + " frame " + m_world.FrameCount); //TODO 吸血 Absorb(damageNumber, skiller, skillData); //伤害处理 SkillUtils.Damage(m_world, skiller, hurter, damageNumber); }