HoloLens 2 Gait Training
The purpose of this project is to create gait training application.
Loading...
Searching...
No Matches
SetNoise.cs
Go to the documentation of this file.
1using System;
2using System.Collections;
3using System.Collections.Generic;
4using TMPro;
5using UnityEngine;
6
11public class SetNoise : MonoBehaviour
12{
13
16
19 [SerializeField] private TextMeshPro m_NoiseLable;
20
23 [SerializeField] private TextMeshPro m_NoiseLableInNoiseDataPanel;
24
26 [SerializeField] private TextMeshPro m_AvatarLable;
27
29 private bool m_Flag = false;
30
31 private GameObject m_NoiseObject = null;
33
37 private void Start()
38 {
39 m_NoiseObject = GameObject.FindGameObjectWithTag("NoisePattern");
41 NoiseController.Instance.BaseNoise = m_NoiseObject.AddComponent<PinkNoise>();
42 }
43
47 private void Update()
48 {
51 if( GameObject.FindGameObjectWithTag("Avatar") == null )
52 {
53 m_Flag = false;
54 }
55 else
56 {
57 m_Flag = true;
58 }
59
60 if( m_Flag )
61 {
62 m_AvatarLable.text = "Speed " + CamMovementTracker.m_CamTrackerInstance.Speed;
63 }
65
66 }
67
75 public void SetNoisePattern( int pattern )
76 {
77 m_PatternType = (ColoredNoise)pattern;
79 }
80
86 private void SetPatternLable()
87 {
88 switch( m_PatternType )
89 {
90 case ColoredNoise.Pink:
91 SetColoredObject("Noise: Pink");
92 NoiseController.Instance.BaseNoise = m_NoiseObject.AddComponent<PinkNoise>();
93 break;
94
95 case ColoredNoise.ISO:
96 SetColoredObject("Noise: ISO");
97 NoiseController.Instance.BaseNoise = m_NoiseObject.AddComponent<ISONoise>();
98 break;
99
100 case ColoredNoise.Random:
101 SetColoredObject("Noise: Random");
102 NoiseController.Instance.BaseNoise = m_NoiseObject.AddComponent<WhiteNoise>();
103 break;
104
105 default:
106 Debug.Log("Incorect Input. Can't Change Labele");
107 m_NoiseLable.text = "!!! Noise: Error !!!";
108 m_NoiseLableInNoiseDataPanel.text = m_NoiseLable.text;
109 break;
110 }
111 }
112
119 private void SetColoredObject( string noise )
120 {
121 m_NoiseLable.text = noise;
123 m_NoiseLableInNoiseDataPanel.text = m_NoiseLable.text;
124 }
125
130 {
131 return m_PatternType;
132 }
133}
ColoredNoise
Describes the type of colored noise.
Definition: Enums.cs:17
A singleton Instance to track Camera Movements This will also calculate distance, rotation and speed ...
static CamMovementTracker m_CamTrackerInstance
Singleton Instance We have 1 Camera instance and 1 User at all time. Therefore, I believe Singleton i...
float Speed
Property to get and set Speed.
Apply a constant speed for the whole walk cycle.
Definition: ISONoise.cs:7
This class is used to set noise pattern levels. When user press a button, it will change the pattern.
Definition: SetNoise.cs:12
void Update()
Definition: SetNoise.cs:47
RemoveAllComponents m_Remover
Definition: SetNoise.cs:32
void SetColoredObject(string noise)
Set the lable and removed previously attached noise game objects. For example, when we transit from p...
Definition: SetNoise.cs:119
TextMeshPro m_AvatarLable
This will show the player's current speed in Avatar label.
Definition: SetNoise.cs:26
bool m_Flag
A flag to check wheather an avatar is spawned or not.
Definition: SetNoise.cs:29
void SetNoisePattern(int pattern)
Gets called from the button's OnClick event. 0 is for deafult pattern 1 is for Pink noise pattern....
Definition: SetNoise.cs:75
TextMeshPro m_NoiseLable
This will show the user selection of the pattern under the avatar in avatar panel.
Definition: SetNoise.cs:19
ColoredNoise GetNoisePattern()
Gettr to get the user's selection.
Definition: SetNoise.cs:129
ColoredNoise m_PatternType
This will hold the user's selected pattern.
Definition: SetNoise.cs:15
void Start()
Definition: SetNoise.cs:37
TextMeshPro m_NoiseLableInNoiseDataPanel
This will show the user selection of the pattern under the NoiseDataPanel.
Definition: SetNoise.cs:23
GameObject m_NoiseObject
Definition: SetNoise.cs:31
void SetPatternLable()
Sets the label according to the user selection. User can see what they selected in Avatar panel under...
Definition: SetNoise.cs:86
Handle the Random (White) Noise.
Definition: WhiteNoise.cs:8