I have and enemy set up with an enemy health script, like this
var health = 1.0;
var hitsound : AudioClip;
function OnTriggerEnter (hit : Collider) {
if (hit.gameObject.tag == "cube") {
health -= 1;
if (hitsound)
AudioSource.PlayClipAtPoint(hitsound, transform.position);
}
}
function Update () {
if (health == 0) {
Destroy (gameObject);
if (hitsound)
AudioSource.PlayClipAtPoint(hitsound, transform.position);
}
}
and I need to have an explosion cause damage to the enemy. I would like to keep my current system, unless I absolutely cant achieve what I need with the way I have it set up. I am using the detonator package, with the chunks pre made explosion, and I need the explosion to cause damage, not the projectile (I’m using a grenade, and so that wont work that way)