protected virtual void attackTarget()
    {
        MinionCombat combat = GetComponent <MinionCombat>();

        if (combat != null)
        {
            combat.attack(currentTarget.GetComponent <CharacterStats>());
        }
    }
    protected virtual void attackTarget()
    {
        MinionCombat combat = GetComponent <MinionCombat>();

        if (combat != null)
        {
            bool fired = combat.attack(currentTarget.GetComponent <CharacterStats>());

            if (fired)
            {
                CharacterStats targetStats = currentTarget.GetComponent <CharacterStats>();
                targetStats.takeDamage(targetStats.damage.GetValue());
            }
        }
    }
Exemplo n.º 3
0
    protected override void attackTarget()
    {
        MinionCombat combat = GetComponent <MinionCombat>();

        if (combat != null)
        {
            bool fired = combat.attack(currentTarget.GetComponent <CharacterStats>());

            if (fired)
            {
                // fire bullet
                GameObject b = Instantiate(bulletPrefab, projectileSpawn.transform.position, Quaternion.identity);

                BulletController controller = b.GetComponent <BulletController>();
                controller.target = currentTarget;
                controller.damage = myStats.damage.GetValue();
            }
        }
    }