Using this code, I get multiple enemies dying at once rather than a single enemy
using UnityEngine;
using System.Collections;
public class EnemyHealth : MonoBehaviour
{
public int startingHealth = 100;
public int currentHealth;
public bool isDead;
void Awake ()
{
currentHealth = startingHealth;
}
void OnCollisionEnter(Collision col)
{
if(col.gameObject.name == "PistolBullet")
{
currentHealth = startingHealth - 10;
}
if (currentHealth <=0)
{
isDead = true;
Dead ();
}
}
void Dead ()
{
if (isDead = true)
{
Destroy (gameObject, 2f);
}
}
}