1using Microsoft.MixedReality.Toolkit.UI;
3using System.Collections.Generic;
4using System.Globalization;
12 #region Private Varibles
19 #region Protected Variables
70 #region Public Varibles
122 Debug.Log(
"Cannot Find NoiseDataPanel Object");
134 int count = basePinkNoiseList.Count();
139 double avg = basePinkNoiseList.Average();
142 double sum = basePinkNoiseList.Sum(d => (d - avg) * (d - avg));
145 ret = Math.Sqrt(sum / (count - 1));
158 double mean = basePinkNoiseList.Average();
161 for (
int i = 0; i < basePinkNoiseList.Count; i++)
163 float val = (float)((basePinkNoiseList[i] - mean) / sd);
200 m_Title.text =
"Pattern reset to default speed ";
201 m_ApplyButton.GetComponent<Interactable>().IsToggled =
false;
204 GameObject avatar = GameObject.FindGameObjectWithTag(
"Avatar");
226 m_Title.text = lbl +
" Noise Ready";
231 m_Title.text = lbl +
" Noise is NOT Ready";
243 string numberPart = textFromUI.Split().Last();
245 bool isValid =
double.TryParse( numberPart, System.Globalization.NumberStyles.Any, CultureInfo.InvariantCulture, out number );
247 if( isValid ==
true )
This class is used to control the avartar animation state.
virtual void PopulateVariablesWithDataFromUI()
Populate data variables used to alter noise. The data are gained through UI lables which are set by t...
TextMeshPro m_PreferredSpeedLabel
abstract void CalculateNoise()
Calculate the colored noise
const float m_NoiseSTD
Hold the standard distribution.
TextMeshPro m_CurrentPattern
float m_MeanPeriod
Hold the Mean Period Value.
void ConvertToZScore(ref List< float > basePinkNoiseList)
This converts Z values to Z Score values. May get off a small amount due to round error.
List< float > m_StandardNoiseDistribution
A List to hold Normal(Gaussian) distribution.
TextMeshPro m_SDPeriodLabel
int m_SampleSize
Defines how many samples we want.
TextMeshPro m_MeanPeriodLabel
We get the value from these text labels.
float m_SDPeriod
Hold the standard distribution period.
float PreferredWalkingSpeed
Property to get user's preferred walking speed (Read-Only)
virtual void GenerateNewDistribution()
Generate a new normal(Gaussian) distribution Mapped to NoiseDataPanel NewDistribution button.
List< float > m_NoiseValueList
This list stores the calculated colored noise values.
abstract void ApplyPattern()
Calculate the noise according to the user input. Mapped to NoiseDataPanel ApplyPattern button.
double GetStandardDeviation(ref List< float > basePinkNoiseList)
This function calculate the sample Standard Deviation value and return it.
bool NoiseAppliedFlag
Property to get noise applied flag (Read-Only)
bool m_NoiseAppliedFlag
This flag will indicate we applied or cancel the noise to animations.
List< float > NoiseDistribution
Property to get standard normal(Gaussian) distribution (Read-Only)
float m_Multiplier
Used this as a multiplier to calculate pink noise.
TextMeshPro m_SampleSizeLabel
double ExtractDecimalFromUI(string textFromUI)
Get the number part from the UI textfields.
void InitializeNoiseDataPanelObjects()
Cache the references of NoiseDataPanel gameobjects.
GameObject m_NoiseDataPanel
Reference to NoiseDataPanel UI.
float m_PreferredWalkingSpeed
Hold the user's preferred walking speed.
const float m_Mean
Hold the Mean value.
TextMeshPro CurrentPattern
Property to get the current noise in use (Read-Only)
void SetReadyMessage(bool flag, string lbl)
Indicate noise is successgully applied or not.
virtual void Awake()
When invoke the scripts performas all the initializations including, Lists, scripts,...
virtual void CanclePattern()
Cancel the current noise pattern and reset it with default speed. Mapped to NoiseDataPanel CancelPatt...
abstract void CalculateBaseNoise()
Calculate the base colored noise
GaussianDistribution m_GaussianDistribution
Reference to GaussianDistribution script.
List< float > NoiseValueList
Property to get colored noise distribution (Read-Only)
GameObject m_DistributionButton
const float m_DefaultISOWalkSpeed
Default ISO preferred walking speed.
virtual void SetUITextVisibility()
Change the visibility of the text fields according to the noise patterns.
Takes two uniformly distributed deviates within the unit circle, and transforms them into two indepen...