-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathGameManager.cs
More file actions
47 lines (40 loc) · 921 Bytes
/
GameManager.cs
File metadata and controls
47 lines (40 loc) · 921 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
using UnityEngine;
using System.Collections;
public class GameManager : MonoBehaviour
{
public static GameManager Instance { get; private set; }
public bool isGamePaused { get; private set; }
public bool isGameOver { get; private set; }
private void Awake()
{
if (Instance == null)
{
Instance = this;
DontDestroyOnLoad(gameObject);
}
else
{
Destroy(gameObject);
}
}
public void PauseGame()
{
isGamePaused = true;
Time.timeScale = 0f;
}
public void ResumeGame()
{
isGamePaused = false;
Time.timeScale = 1f;
}
public void GameOver()
{
isGameOver = true;
// Add your game over logic here
}
public void RestartGame()
{
isGameOver = false;
// Add your restart logic here
}
}