// Helper method to destroy the player object. private void Die() { if (deathSFX == DeathSFX.NORMAL) { AudioController.Hurt(); } else if (deathSFX == DeathSFX.EXPLODE) { AudioController.ElectricalExplode(); } else if (deathSFX == DeathSFX.SHATTER) { AudioController.CrystalShatter(); } Debug.Log(name + " has fallen."); if (destroyPrefab != null) { Instantiate(destroyPrefab, transform.position, transform.rotation); } Destroy(gameObject); }