void FlyDamageLogic(EntityBase fly, EntityBase entity) { FlyObjectComponent fc = fly.GetComp <FlyObjectComponent>(); LifeComponent lc = entity.GetComp <LifeComponent>(); lc.life -= fc.damage; //派发事件 ECSEvent.DispatchEvent(GameUtils.GetEventKey(entity.ID, CharacterEventType.Damage), entity); }
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; } Debug.Log("Damage!"); //TODO 吸血 Absorb(damageNumber, skiller, skillData); //伤害处理 LifeComponent lc = hurter.GetComp <LifeComponent>(); lc.life -= damageNumber; ECSEvent.DispatchEvent(GameUtils.GetEventKey(hurter.ID, CharacterEventType.Damage), hurter); }