// do explosions and things here private void die() { isAlive = false; if (CompareTag("Enemy")) { EnemyDeath ed = GetComponent <EnemyDeath> (); if (ed != null) { ed.onEnemyDeath(); } } playRandomSound(DeathSounds); if (deathEffect != null) { Instantiate(deathEffect, transform.position, Quaternion.identity); } Destroy(gameObject); }