-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGenerate.cs
More file actions
70 lines (66 loc) · 2.27 KB
/
Generate.cs
File metadata and controls
70 lines (66 loc) · 2.27 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
60
61
62
63
64
65
66
67
68
69
70
using System.Collections;
using UnityEngine;
namespace RandomizerMod
{
public class Generate : MonoBehaviour
{
public float _timer = 5f;
private bool _canGenerate = true;
private int _lastEvent;
private int _event;
void OnGUI()
{
if (_canGenerate)
{
Texture2D black = new Texture2D(1, 1);
black.SetPixel(0, 0, Color.black * 0.75f);
black.Apply();
GUIStyle Timer = new GUIStyle();
Timer.normal.textColor = Color.white;
Timer.normal.background = black;
Timer.fontSize = 57;
Timer.fontStyle = FontStyle.Bold;
Timer.alignment = TextAnchor.MiddleCenter;
Timer.padding = new RectOffset(0, 0, 0, -10);
GUIStyle UNE = new GUIStyle();
UNE.normal.textColor = Color.white;
UNE.fontSize = 12;
UNE.fontStyle = FontStyle.Bold;
UNE.alignment = TextAnchor.UpperCenter;
UNE.padding = new RectOffset(0, 0, 0, 15);
GUI.Box(new Rect(Screen.width / 2 - 75, 25, 150, 75), _timer > 10 ? $"{_timer:00.0}" : $"{_timer:0.00}", Timer);
GUI.Label(new Rect(Screen.width / 2 - 75, 25, 150, 75), "UNTIL NEXT EVENT", UNE);
}
}
void Update()
{
if (_canGenerate)
{
if (_timer != 0)
{
_timer -= Time.deltaTime;
}
if (_timer <= 0)
{
_timer = 15;
StartCoroutine(ProceedEvents());
}
}
if(Input.GetKeyDown(KeyCode.Pause))
{
_canGenerate = false;
EventSystem.Instance.ResetEvent();
}
}
IEnumerator ProceedEvents()
{
EventSystem.Instance.SetEvent();
if(Setup.Instance.audS.clip != null)
Setup.Instance.audS.Play();
yield return new WaitForSeconds(5);
EventSystem.Instance.HideEventText();
yield return new WaitForSeconds(5);
EventSystem.Instance.ResetEvent();
}
}
}