//Display a stimulus, and complete when the stimulus is done private IEnumerator PresentStimulus(TrialConfig config) { GameObject circle = Instantiate(circlePrefab); FlashSprite fs = circle.GetComponent <FlashSprite>(); fs.SetColor(config["R"][0], config["G"][0], config["B"][0], 1.0f); yield return(new WaitForSeconds(fs.flashDuration)); }
//Display a stimulus, and complete when the stimulus is done private IEnumerator PresentStimulus(TrialConfig config) { GameObject circle = Instantiate(circlePrefab); FlashSprite fs = circle.GetComponent <FlashSprite>(); Color c = Color.HSVToRGB(config["hue"][0], 1.0f, 0.15f); fs.SetColor(c.r, c.g, c.b, config["alpha"][0]); yield return(new WaitForSeconds(fs.flashDuration)); }
// ShowStimuli (MANDATORY) // Display a stimulus, and finish when the stimulus is done. // Use the dimension names defined in your config file as string keys to access the float lists // contained in the TrialConfig. Experiment will not continue running until EndShowStimuli is called. public override void ShowStimuli(TrialConfig config) { SetText("Now presenting stimulus."); GameObject circle = Instantiate(circlePrefab); FlashSprite fs = circle.GetComponent <FlashSprite>(); fs.SetColor(config["R"][0], config["G"][0], config["B"][0], 1.0f); StartCoroutine(EndShowStimuliAfterSeconds(fs.flashDuration)); }
// ShowStimuli (MANDATORY) // Display a stimulus, and finish when the stimulus is done. // Use the dimension names defined in your config file as string keys to access the float lists // contained in the TrialConfig. Experiment will not continue running until EndShowStimuli is called. public override void ShowStimuli(TrialConfig config) { GameObject circle = Instantiate(circlePrefab); FlashSprite fs = circle.GetComponent <FlashSprite>(); Color c = Color.HSVToRGB(config["hue"][0], config["saturation"][0], 0.2f); fs.SetColor(c.r, c.g, c.b, config["alpha"][0]); StartCoroutine(EndShowStimuliAfterSeconds(fs.flashDuration)); SetText("Now presenting stimulus."); }
IEnumerator DisplayOptimal() { yield return(StartCoroutine(client.Query(QueryType.max))); QueryMessage m = client.GetQueryResponse(); TrialConfig maxLoc = m.x; GameObject circle = Instantiate(circlePrefab); FlashSprite fs = circle.GetComponent <FlashSprite>(); fs.SetColor(maxLoc["R"][0], maxLoc["G"][0], maxLoc["B"][0], 1.0f); fs.flashDuration = -1.0f; //never destroy }
IEnumerator DisplayOptimal() { yield return(StartCoroutine(client.Query(QueryType.inverse, y: 0.75f, probability_space: true))); QueryMessage m = client.GetQueryResponse(); TrialConfig maxLoc = m.x; GameObject circle = Instantiate(circlePrefab); FlashSprite fs = circle.GetComponent <FlashSprite>(); fs.flashDuration = -1.0f; //never destroy Color c = Color.HSVToRGB(maxLoc["hue"][0], maxLoc["saturation"][0], 0.2f); fs.SetColor(c.r, c.g, c.b, maxLoc["alpha"][0]); }