public virtual void ApplyDamage(int damage) { currentHp -= damage; if (currentHp <= 0) { if (!(this is PlayerShip)) { FindObjectOfType <EnemySpawner>().UpdateDeadEnemy(gameObject); } soundM.PlaySFX(SFX.damage_taken); Instantiate(explosion, null).transform.position = transform.position; Destroy(gameObject); } else { soundM.PlaySFX(SFX.damage_taken_2); } }