public void GameRestart() { //SceneManager.LoadScene(0); player.transform.position = Vector3.zero; player.gameObject.SetActive(true); PlayerLife = DefaultPlayerLife - 1; ui.SetPlayerLife(PlayerLife); Score = 0; ui.SetScore(Score); ui.HideGameOver(); hazardRoutine = StartCoroutine(Hazards()); for (int i = 0; i < BGs.Length; i++) { BGs[i].StartScroll(); } }
// Use this for initialization void Start() { IsGameOver = false; IsBossAlive = false; player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerController>(); PlayerLife = DefaultPlayerLife - 1; hazardRoutine = StartCoroutine(Hazards()); for (int i = 0; i < BGs.Length; i++) { BGs[i].StartScroll(); } Score = 0; ui = GameObject.FindGameObjectWithTag("UI").GetComponent <MainUIController>(); ui.SetScore(Score); ui.SetPlayerLife(PlayerLife); currentStageNumber = 1; }