public void Hited(Attack attack) { hp -= attack.damage; damageText.Float(attack.damage.ToString(), transform.position + Vector3.up * 0.5f); if (useHitEffect) { EffectAnimator.Play(hitEffect, transform.position); } if (hp < 0) { hp = 0; } attack.OnHit?.Invoke(this); if (hp != 0) { animator.Hited(); } if (hp == 0) { isDead = true; Dead(); attack.OnKill?.Invoke(this); } }
// 광역 공격 public void Active(List <string> targetTags, Action <Character> OnHit = null, Action <Character> OnKill = null) { int damage = owner.damage; Attack attack = new Attack(damage); attack.OnHit = OnHit; attack.OnKill = OnKill; if (useEffect) { attack.OnHit += t => EffectAnimator.Play(effectName, t.transform.position, effectScale); } Action act = () => _Active(attack, targetTags); if (preDelay == 0) { act(); } else { StartCoroutine(act.After(preDelay)); } }
protected override void _Active(Attack attack, List <string> targetTags) { Attack self = new Attack(9999); self.OnHit += t => EffectAnimator.Play(selfBombId, transform.position, selfBombScale); owner.Hited(self); base._Active(attack, targetTags); }