You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Assets/Scripts/GameManager.cs
+19Lines changed: 19 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -4,13 +4,27 @@
4
4
5
5
publicclassGameManager:MonoBehaviour
6
6
{
7
+
publicstaticGameManagerInstance{get;privateset;}
8
+
7
9
publicstaticints_CurrentLevel=0;
8
10
9
11
publicstaticints_MaxAvailableLevel=5;
10
12
11
13
// The value of -1 means no hats have been purchased
12
14
publicstaticints_ActiveHat=0;
13
15
16
+
publicvoidAwake()
17
+
{
18
+
if(Instance==null)
19
+
{
20
+
Instance=this;
21
+
}
22
+
else
23
+
{
24
+
Destroy(gameObject);
25
+
}
26
+
}
27
+
14
28
publicvoidOnEnable()
15
29
{
16
30
// When we go to the
@@ -22,6 +36,11 @@ public void ExitGame()
22
36
s_CurrentLevel=0;
23
37
}
24
38
39
+
publicvoidSetCurrentLevel(intlevel)
40
+
{
41
+
s_CurrentLevel=level;
42
+
}
43
+
25
44
publicstaticvoidLoadNextLevel()
26
45
{
27
46
// We are going to be using the Addressables API to manage our scene loading and unloading, the equivalent way on the UnityEngine.SceneManagement API is:
0 commit comments