public void Hurt() { currentLife--; if (currentLife <= 0) { deathAudioSource.Play(); deathAudioPlayer.transform.parent = null; if (boss) { musicPlayer.Stop(); BossFightEnder.GetInstance().WaitForSecondsAndLoadNextScene(deathAudioSource.clip.length); } Destroy(gameObject); } healthBar.localScale = new Vector3((float)currentLife / startLife, healthBar.localScale.y, healthBar.localScale.z); }
void Start() { instance = this; }