Ejemplo n.º 1
0
    void Attack()
    {
        timer = 0f;

        if (playerHealth.currentHealth > 0)
        {
            playerHealth.TakeDamage(attackDamage);
        }
    }
Ejemplo n.º 2
0
    void Explode()
    {
        foreach (Collider collider in Physics.OverlapSphere(transform.position, radius))
        {
            Bombs_EnemyHealth enemyHealth = collider.GetComponent <Bombs_EnemyHealth>();

            if (enemyHealth != null)
            {
                enemyHealth.TakeDemage(damage);
            }

            Bombs_PlayerHealth playerHealth = collider.GetComponent <Bombs_PlayerHealth>();

            if (playerHealth != null)
            {
                playerHealth.TakeDamage(damage);
            }
        }

        Destroy(gameObject);
    }