Example #1
0
    public void randomAttack2(UnitHealth target)
    {
        if (unitScript.blocking == true)
        {
            BlockAttack(target);
            return;
        }

        int RandomNum = (int)Random.Range(0, attack2Anims.Length);

        animator.SetTrigger(attack2Anims[RandomNum]);
        target.TakeDamageWDelayed(unitScript.basicAttackDamage, attack2AnimHitTimes[RandomNum]);
        target.TakeDamageWDelayedWKnockback(unitScript.basicAttackDamage, attack2SecondaryHitTimes[RandomNum], transform.position, (unitScript.heavyAttackDamage));
    }
Example #2
0
    public void Explode()
    {
        Collider[] hitColliders = Physics.OverlapSphere(transform.position, explosionRadius);

        for (int i = 0; i < hitColliders.Length; i++)
        {
            UnitHealth unit = hitColliders[i].GetComponent <UnitHealth>();
            try
            {
                unit.TakeDamageWDelayedWKnockback(indirectDamage, 0.1f, transform.position, explosionKnockback);
            }
            catch
            {
            }
        }
    }