예제 #1
0
 public void TargetAttack(Action attackCallback, AttackTargetEventArgs args, bool forceTargeting = false)
 {
     if (forceTargeting || AllowAttackTargets)
     {
         OnAttackTargeting(args);
         AffectAttack(attackCallback, forceTargeting);
         OnAttackTargeted(args);
     }
 }
예제 #2
0
        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);
            }
        }
예제 #3
0
 protected virtual void OnAttackTargeted(AttackTargetEventArgs e)
 {
     AttackTargeted?.Invoke(this, e);
 }