-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgameManager.cs
More file actions
59 lines (47 loc) · 1.12 KB
/
gameManager.cs
File metadata and controls
59 lines (47 loc) · 1.12 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
using UnityEngine;
using UnityEngine.SceneManagement;
public class gameManager : MonoBehaviour
{
[SerializeField] private string Difficulty = "NORMAL";
#region Difficulty settings
private void Awake()
{
Difficulty = PlayerPrefs.GetString("GameDifficulty", "NORMAL");
}
public void SetDifficulty(string newDifficulty)
{
Difficulty = newDifficulty;
PlayerPrefs.SetString("GameDifficulty", newDifficulty);
PlayerPrefs.Save();
}
public void SetEasy()
{
SetDifficulty("EASY");
}
public void SetNormal()
{
SetDifficulty("NORMAL");
}
public void SetHard()
{
SetDifficulty("HARD");
}
#endregion
public void RestartLevel()
{
// Reloads the level
SceneManager.LoadScene(SceneManager.GetActiveScene().name);
Time.timeScale = 1f;
}
public void MainMenu()
{
// Loads main menu
SceneManager.LoadScene("Start Menu");
Time.timeScale = 1f;
}
public void LoadLastCheckpoint()
{
// load last checkpoint
Time.timeScale = 1f;
}
}