|
|
@@ -5,6 +5,8 @@ using UnityEngine.SceneManagement;
|
|
|
public class GameManager : MonoBehaviour
|
|
|
{
|
|
|
public static GameManager Instance;
|
|
|
+ public GameObject GameOverUI;
|
|
|
+ public GameObject VictoryUI;
|
|
|
|
|
|
[Header("Orb Settings")]
|
|
|
public int totalOrbs = 20;
|
|
|
@@ -20,7 +22,7 @@ public class GameManager : MonoBehaviour
|
|
|
|
|
|
void Awake()
|
|
|
{
|
|
|
- if (Instance == null)
|
|
|
+ if (Instance == null)
|
|
|
{
|
|
|
Instance = this;
|
|
|
} else
|
|
|
@@ -80,13 +82,37 @@ public class GameManager : MonoBehaviour
|
|
|
|
|
|
void Victory()
|
|
|
{
|
|
|
+ VictoryUI.SetActive(true);
|
|
|
gameOver = true;
|
|
|
+
|
|
|
+ Time.timeScale = 0f;
|
|
|
+
|
|
|
+ Cursor.lockState = CursorLockMode.None;
|
|
|
+ Cursor.visible = true;
|
|
|
+
|
|
|
Debug.Log("YOU WIN!");
|
|
|
}
|
|
|
|
|
|
void GameOver()
|
|
|
{
|
|
|
+ GameOverUI.SetActive(true);
|
|
|
gameOver = true;
|
|
|
+
|
|
|
+ Time.timeScale = 0f;
|
|
|
+
|
|
|
+ Cursor.lockState = CursorLockMode.None;
|
|
|
+ Cursor.visible = true;
|
|
|
+
|
|
|
+
|
|
|
Debug.Log("YOU LOSE!");
|
|
|
}
|
|
|
+
|
|
|
+ public void RestartGame()
|
|
|
+ {
|
|
|
+ Time.timeScale = 1f;
|
|
|
+ SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
|
|
|
+
|
|
|
+ Cursor.lockState = CursorLockMode.Locked;
|
|
|
+ Cursor.visible = false;
|
|
|
+ }
|
|
|
}
|