コード例 #1
0
    public override ActiveSkill UseSkill()
    {
        bool atLeastOneTargetInRange = false;

        IEnumerable <Attackable> targets = TargetingFunction.DetectSurroundings(this, _heal.IsValidTarget).Cast <Attackable>();

        foreach (Attackable target in targets)
        {
            bool targetInRange = _heal.IsUsable(this, target);
            atLeastOneTargetInRange = atLeastOneTargetInRange || targetInRange;
            if (targetInRange)
            {
                if (_heal.Cooldown <= 0 && target.MaxHp - target.Hp > _heal.heal)
                {
                    _heal.ApplyOnTarget(target);
                    _heal.Cooldown = 1.0f;
                    return(_heal);
                }
            }
        }

        return(TargetingFunction.UseAttack(this, _attack));
    }
コード例 #2
0
    public override bool UseSkill()
    {
        bool atLeastOneTargetInRange = false;

        List <Attackable> targets = TargetingFunction.DetectSurroundings(this, heal.isValidTarget);

        foreach (Attackable target in targets)
        {
            bool targetInRange = heal.IsUsable(this, target);
            atLeastOneTargetInRange = atLeastOneTargetInRange || targetInRange;
            if (targetInRange)
            {
                if (heal.cooldown <= 0 && target.MaxHp - target.Hp > heal.heal)
                {
                    heal.ApplyOnTarget(target);
                    heal.cooldown = 1.0f;
                    return(true);
                }
            }
        }

        return(TargetingFunction.UseAttack(this, attack));
    }