public void GazeShift(int target) { StopStimulating(); Color Gray = new Color(0.3f, 0.3f, 0.3f, 1); foreach (Flicky f in flickyList) { f.SetMainColor(Gray); } Color Red = new Color(1, 0.3f, 0.3f, 1); Flicky flicky = flickyList[target]; flicky.SetMainColor(Red); }
public void InitialTargets(Vector3[] positions, Vector3[] qs, float[] freqs, string[] labels = null, string[] layers = null, int[] modulations = null, float[] modulationFreqs = null, float[] phases = null, float[] dutyCycles = null) { if (targetList != null) { foreach (GameObject gameObject in targetList) { Destroy(gameObject); } foreach (GameObject gameObject in labelTextList) { Destroy(gameObject); } } if (labels == null) { labels = new string[positions.Length]; for (int i = 0; i < positions.Length; ++i) { labels[i] = i.ToString(); } } if (layers == null) { layers = new string[positions.Length]; for (int i = 0; i < positions.Length; ++i) { layers[i] = "Default"; } } if (modulations == null) { modulations = Enumerable.Repeat(0, positions.Length).ToArray(); } if (modulationFreqs == null) { modulationFreqs = Enumerable.Repeat(-1f, positions.Length).ToArray(); } if (phases == null) { phases = Enumerable.Repeat(0f, positions.Length).ToArray(); } if (dutyCycles == null) { dutyCycles = Enumerable.Repeat(0.5f, positions.Length).ToArray(); } targetList = new List <GameObject>(); flickyList = new List <Flicky>(); labelTextList = new List <GameObject>(); Color Gray = new Color(0.3f, 0.3f, 0.3f, 1); for (int i = 0; i < positions.Length; ++i) { GameObject tmpObject = Instantiate(flicky, positions[i], Quaternion.Euler(qs[i])); Flicky tmpFlicky = tmpObject.GetComponent <Flicky>(); tmpObject.layer = LayerMask.NameToLayer(layers[i]); tmpFlicky.Initialize(); tmpFlicky.SetSavedFrequency(freqs[i], modulations[i], modulationFreqs[i], phases[i], dutyCycles[i]); tmpFlicky.SetMainColor(Gray); targetList.Add(tmpObject); flickyList.Add(tmpFlicky); GameObject tmpLabelObject = Instantiate(labelText, positions[i], Quaternion.Euler(0, 0, 0)); TextMesh tmpTextMesh = tmpLabelObject.GetComponent <TextMesh>(); tmpTextMesh.text = labels[i]; labelTextList.Add(tmpLabelObject); } }