-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGameManager.cs
55 lines (44 loc) · 1.17 KB
/
GameManager.cs
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
using System.Collections;
using UnityEngine;
public class GameManager : MonoBehaviour {
public GameObject Ready;
public GameObject Set;
public GameObject Go;
public AudioSource[] sounds;
void Start()
{
Cursor.lockState = CursorLockMode.Locked;
Cursor.visible = false;
Ready.SetActive(true);
sounds[1].PlayDelayed(0.75f);
StartCoroutine(SetTimer());
StartCoroutine(GoTimer());
StartCoroutine(EnableMouse());
}
private void Update()
{
if (sounds[0].time > sounds[0].clip.length - 0.05f)
{
sounds[0].Play();
}
}
IEnumerator SetTimer()
{
yield return new WaitForSeconds(2);
Set.SetActive(true);
sounds[1].PlayDelayed(0.9f);
}
IEnumerator GoTimer()
{
yield return new WaitForSeconds(3);
Go.SetActive(true);
sounds[2].PlayDelayed(1.1f);
}
IEnumerator EnableMouse()
{
yield return new WaitForSeconds(4.25f);
Cursor.lockState = CursorLockMode.None;
Cursor.visible = true;
sounds[0].Play();
}
}