Tanoda
TutorialStart.cs
Go to the documentation of this file.
1
using
System.Collections;
2
using
System.Collections.Generic;
3
using
NaughtyAttributes;
4
using
UnityEngine
;
5
using
UnityEngine
.
Events
;
6
using
UnityEngine
.
UI
;
7
8
public
class
TutorialStart
: MonoBehaviour
9
{
10
public
GameObject
selector
,
hudCanvas
;
11
public
Image
HandLoader
;
12
public
UnityEvent
onSelected
;
13
public
string
text
;
14
15
private
bool
selecting =
false
;
16
17
void
Start()
18
{
19
hudCanvas
.SetActive(
false
);
20
}
21
22
void
Update()
23
{
24
if
(!selecting)
25
{
26
var c =
HandLoader
.color;
27
c.a -= 0.05f;
28
c.a = Mathf.Max(0, c.a);
29
HandLoader
.color = c;
30
}
31
else
32
{
33
var c =
HandLoader
.color;
34
c.a += 0.05f;
35
c.a = Mathf.Min(1, c.a);
36
HandLoader
.color = c;
37
if
(c.a >= 1.0f)
38
{
39
onSelected
?.Invoke();
40
hudCanvas
.SetActive(
true
);
41
}
42
}
43
}
44
45
[
Button
]
46
private
void
Select()
47
{
48
onSelected
?.Invoke();
49
hudCanvas
.SetActive(
true
);
50
51
}
52
53
private
void
OnTriggerExit(Collider other)
54
{
55
if
(other.gameObject ==
selector
)
56
{
57
selecting =
false
;
58
}
59
}
60
61
private
void
OnTriggerEnter(Collider other)
62
{
63
if
(other.gameObject ==
selector
)
64
{
65
selecting =
true
;
66
}
67
}
68
69
public
void
SpeakIfSelected
()
70
{
71
#if DANA
72
VoiceTTS
.Speak(
text
);
73
#endif
74
}
75
76
77
}
Button
UnityEngine.UI.Button Button
Definition:
Pointer.cs:7
Image
System.Drawing.Image Image
Definition:
TestScript.cs:37
TutorialStart
Definition:
TutorialStart.cs:9
TutorialStart.text
string text
Definition:
TutorialStart.cs:13
TutorialStart.selector
GameObject selector
Definition:
TutorialStart.cs:10
TutorialStart.hudCanvas
GameObject hudCanvas
Definition:
TutorialStart.cs:10
TutorialStart.HandLoader
Image HandLoader
Definition:
TutorialStart.cs:11
TutorialStart.onSelected
UnityEvent onSelected
Definition:
TutorialStart.cs:12
TutorialStart.SpeakIfSelected
void SpeakIfSelected()
Definition:
TutorialStart.cs:69
VoiceTTS
Definition:
VoiceTTS.cs:9
UnityEngine.Events
UnityEngine.UI
Definition:
HSVPicker/UtilityScripts/BoxSlider.cs:7
UnityEngine
Definition:
HSVPicker/UtilityScripts/BoxSlider.cs:7
Source
Assets
Scripts
TestScripts
TutorialStart.cs
Generated by
1.9.3