Tanoda
TutorialStart.cs
Go to the documentation of this file.
1using System.Collections;
2using System.Collections.Generic;
3using NaughtyAttributes;
4using UnityEngine;
6using UnityEngine.UI;
7
8public class TutorialStart : MonoBehaviour
9{
10 public GameObject selector, hudCanvas;
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}
UnityEngine.UI.Button Button
Definition: Pointer.cs:7
System.Drawing.Image Image
Definition: TestScript.cs:37
GameObject selector
GameObject hudCanvas
UnityEvent onSelected
void SpeakIfSelected()