Tanoda
NeuroStatGUI.cs
Go to the documentation of this file.
1using System.Collections;
2using System.Collections.Generic;
3#if !UNITY_WEBGL && DANA
4using NextMind.NeuroTags;
5#endif
6using UnityEngine;
7using UnityEngine.UI;
8#if !UNITY_WEBGL && DANA
9[RequireComponent(typeof(NeuroTag)/*, typeof(Collider)*/)]
10#endif
11public class NeuroStatGUI : MonoBehaviour
12{
13 private Camera cam;
14 private GameObject go;
15 //private Collider coll;
16 private float conf = 0.0f;
17 private bool triggered, maintained, active = false;
18 private float trigg, maintainStart;
19 public Text text;
20
21 private void Start()
22 {
23 cam = Camera.main;
24#if !UNITY_WEBGL && DANA
25 go = GetComponent<NeuroTag>().StimulationRenderers[0];
26#endif
27 //coll = GetComponent<Collider>();
28 }
29
30 public void OnConfidenceChanged(float value)
31 {
32 conf = value;
33 }
34
35 public void OnTriggered()
36 {
37 triggered = true;
38 trigg = Time.time;
39 Debug.Log("OnTriggered @ " + Time.time);
40 }
41
42 public void OnMaintainned()
43 {
44 if (!maintained)
45 {
46 maintainStart = Time.time;
47 }
48 maintained = true;
49 Debug.Log("OnMaintainned @ " + Time.time);
50 }
51
52 public void OnReleased()
53 {
54 triggered = false;
55 maintained = false;
56 }
57
58 public void OnBecameActivated()
59 {
60 active = true;
61 }
62
63 public void OnBecameDeactivated()
64 {
65 active = false;
66 }
67
68 void Update()
69 {
70
71 text.text = $"Confidence: {conf:P2}\nLast triggered at {trigg:F1}\nMaintained: {(maintained ? (Time.time - maintainStart).ToString("F1") : "False")}\nActive: {active}";
72 }
73}
UnityEngine.Debug Debug
Definition: TanodaServer.cs:19
void OnBecameDeactivated()
Definition: NeuroStatGUI.cs:63
void OnMaintainned()
Definition: NeuroStatGUI.cs:42
void OnBecameActivated()
Definition: NeuroStatGUI.cs:58
void OnTriggered()
Definition: NeuroStatGUI.cs:35
void OnReleased()
Definition: NeuroStatGUI.cs:52
void OnConfidenceChanged(float value)
Definition: NeuroStatGUI.cs:30