29 lines
600 B
C#
29 lines
600 B
C#
using UnityEngine;
|
|
using UnityEngine.SceneManagement;
|
|
|
|
public class GameManager : MonoBehaviour
|
|
{
|
|
bool GameHasEnded=false;
|
|
|
|
public float restartDelay=1f;
|
|
|
|
public GameObject completeLevelUI;
|
|
|
|
public void EndGame() {
|
|
if (!GameHasEnded) {
|
|
Debug.Log("Game Over");
|
|
GameHasEnded=true;
|
|
Invoke("Restart",restartDelay);
|
|
}
|
|
}
|
|
|
|
void Restart() {
|
|
SceneManager.LoadScene(SceneManager.GetActiveScene().name);
|
|
}
|
|
|
|
public void CompleteLevel() {
|
|
Debug.Log("Done");
|
|
completeLevelUI.SetActive(true);
|
|
}
|
|
}
|