public void GameOver() { inGameOver = true; uIBehavior.GameOver(); String playerName = PlayerPrefs.GetString("name"); highscoreTable.AddHighscoreEntry(playerScore, playerName); highscoreTable.HighlightLine(true); player.SetActive(false); spawnManager.enabled = false; }
protected override void Die() { anim.SetTrigger("TDie"); PlaySound(); GameObject.Destroy(gameObject, 1f); this.isDead = true; //TODO: Show Game Over screen /*UnityEngine.SceneManagement.Scene scene = UnityEngine.SceneManagement.SceneManager.GetActiveScene(); //current scene * UnityEngine.SceneManagement.SceneManager.LoadSceneAsync(scene.name, LoadSceneMode.Single);*/ GameObject uiCanvas = GameObject.FindGameObjectWithTag("UICanvas"); if (uiCanvas != null) { UIBehavior uiBehavior = uiCanvas.GetComponent <UIBehavior>(); uiBehavior.GameOver(); } }