Preview:
if (isExplosion) {
    foreach (GameObject enemy in units) {
        float distanceToEnemy = Vector3.Distance (transform.position, enemy.transform.position);
        if (distanceToEnemy <= explosionRadius) {
            Unit unit = enemy.GetComponent<Unit> ();
            float proximity = (transform.position - enemy.transform.position).magnitude;
            float effect = 1 - (proximity / explosionRadius);
            unit.TakeDamage ((int) (damage * effect));
            if (enemy.GetComponent<Setup> ().currentHealth <= 0) {
                GameObject explosionDestroy = Instantiate (enemy.GetComponent<Setup> ().explosionDestroy, enemy.transform.position, Quaternion.identity);
                Destroy (explosionDestroy, 1);
                Destroy (enemy);
            }
        }
    }
}
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter