public void Die() { hudManager.TakeOneLife(); if (hudManager.GetLivesCounter() > 0) { if (levelTransition.GetFirstLevelPassed()) { soundManager.StopBackgroundMusicFirstLevel(); } else if (levelTransition.GetSecondLevelPassed()) { soundManager.StopBackgroundMusicSecondLevel(); } else { soundManager.StopBackgroundMusicThirdLevel(); } soundManager.PlayPlayerDiedSound(); scenesManager.ShowPlayerDiedMenu(); scenesManager.CloseHud(); Destroy(this.gameObject); //player is destroyed } else { soundManager.PlayGameOverSound(); scenesManager.ShowGameOverMenu(); scenesManager.CloseHud(); Destroy(this.gameObject); //player is destroyed } }
public void NextLevel() { //ako je prvi level prijeđen, loadaj drugi level/scenu if (levelTransition.GetFirstLevelPassed()) { Time.timeScale = 1f; SceneManager.LoadScene("SecondLevel"); } //ako je drugi level prijeđen, loadaj treći level/scenu else if (levelTransition.GetSecondLevelPassed()) { Time.timeScale = 1f; SceneManager.LoadScene("ThirdLevel"); } }
void Start() { gameObject.AddComponent <AudioSource>(); PlayBackgroundMusicFirstLevel(); if (levelTransition.GetFirstLevelPassed()) { StopBackgroundMusicFirstLevel(); PlayBackgroundMusicSecondLevel(); } else if (levelTransition.GetSecondLevelPassed()) { StopBackgroundMusicSecondLevel(); PlayBackgroundMusicThirdLevel(); } }