public void TargetAttack(Action attackCallback, AttackTargetEventArgs args, bool forceTargeting = false) { if (forceTargeting || AllowAttackTargets) { OnAttackTargeting(args); AffectAttack(attackCallback, forceTargeting); OnAttackTargeted(args); } }
void PerformAttack(Actor actor, Damage damage, bool useCooldown) { if (!actor.TryGetModule <IDamageable>(out var damageTarget)) { return; } if (actor.TryGetModule <ITargetable>(out var targetable)) { var args = new AttackTargetEventArgs(Actor, damage); var callback = GetAttackCallback(actor, damageTarget, damage, useCooldown); targetable.TargetAttack(callback, args); } else { InternalPerformAttack(actor, damageTarget, damage, useCooldown); } }
protected virtual void OnAttackTargeted(AttackTargetEventArgs e) { AttackTargeted?.Invoke(this, e); }