-
Notifications
You must be signed in to change notification settings - Fork 0
/
OperatorControls.cs
84 lines (75 loc) · 2.07 KB
/
OperatorControls.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
using UdonSharp;
using UnityEngine;
using UnityEngine.UI;
using VRC.SDKBase;
using VRC.Udon;
[AddComponentMenu("")]
public class OperatorControls : UdonSharpBehaviour
{
public Manager manager;
private int hintNumber;
private bool isEnabled;
private string teamName;
public void Setup(string team)
{
Debug.Log("Operator setup");
this.teamName = team;
this.reset();
}
public void Teardown()
{
this.reset();
}
public void StartTurn()
{
manager.UpdateText("Operator turn started: " + this.teamName);
this.isEnabled = true;
}
public void EndTurn()
{
if (this.isEnabled == false)
{
return;
}
manager.UpdateText("Operator turn stopped: " + this.teamName);
this.isEnabled = false;
this.manager.OperatorEndTurn(this.hintNumber);
this.reset();
}
public void IncrementHint()
{
if (this.isEnabled == false)
{
return;
}
this.hintNumber = this.hintNumber + 1;
if (hintNumber == 0)
{
manager.UpdateText("It's the " + this.teamName + " operator's turn! They have a bonus guess!");
}
else
{
manager.UpdateText("It's the " + this.teamName + " operator's turn! Current guesses remaining: " + this.hintNumber);
}
}
public void DecrementHint()
{
if (this.isEnabled == false)
{
return;
}
if (this.hintNumber < 1)
{
this.hintNumber = 0;
manager.UpdateText("It's the " + this.teamName + " operator's turn! Current number of guesses: " + this.hintNumber);
return;
}
this.hintNumber = this.hintNumber - 1;
manager.UpdateText("It's the " + this.teamName + " operator's turn! Current number of guesses: " + this.hintNumber);
}
private void reset()
{
this.hintNumber = 0;
this.isEnabled = false;
}
}