/// <summary> /// Returns false if the color is red. Every other color is checked as true. /// </summary> protected bool IsValidStimulusColor(Trial t) { ReactTrialRed RTR = t as ReactTrialRed; if (RTR.isRed) { return(false); } else { return(true); } }
/// <summary> /// Displays the Stimulus for a specified duration. /// During that duration the player needs to respond as quickly as possible. /// </summary> protected virtual IEnumerator DisplayStimulus(Trial t) { GameObject stim = stimulus; stim.SetActive(false); yield return(new WaitForSeconds(t.delay)); StartInput(); ReactTrialRed RTR = t as ReactTrialRed; // Set color of the stimulus as given in the trial if (RTR.isRed) { stim.GetComponent <Image>().color = Color.red; currentColorIsRed = true; } if (!RTR.isRed) { stim.GetComponent <Image>().color = Color.white; currentColorIsRed = false; } // Set position of the stimulus as given in the trial. if (RTR.isRandomPos) { StimRandomPos.x = GetRandomX(RTR.minX, RTR.maxX); StimRandomPos.y = GetRandomY(RTR.minY, RTR.maxY); stim.GetComponent <RectTransform>().anchoredPosition = StimRandomPos; GUILog.Log("Current stimulus position: " + stim.GetComponent <RectTransform>().position.ToString()); } else { StimRandomPos.x = RTR.fixedX; StimRandomPos.y = RTR.fixedY; stim.GetComponent <RectTransform>().anchoredPosition = StimRandomPos; GUILog.Log("Current stimulus position: " + stim.GetComponent <RectTransform>().position.ToString()); } stim.SetActive(true); yield return(new WaitForSeconds(((ReactTrialRed)t).duration)); stim.SetActive(false); EndInput(); yield break; }