Beispiel #1
0
    public IEnumerator Attack(Attackable target)
    {
        // if already attacking or enemy out of range do not allow to attack
        if (!_canAtk || TileObject.MaxDistance(this.tileObj, target.tileObj) > range)
        {
            yield break;
        }

        OnAttackBegin();

        target.ApplyDamage(damage);

        yield return(new WaitForSeconds(attackRate));

        OnAttackEnd();
    }