//Creates List of StroopItems void BuildList() { int val; if (numStimuli % combinations.Length == 0) { val = numStimuli / combinations.Length; } else { val = (numStimuli / combinations.Length) + 1; } List <StroopItem> stroopBucket = new List <StroopItem>(numStimuli); for (int i = 0; i < val; i++) { for (int n = 0; n < combinations.Length; n++) { stroopBucket.Add(combinations[n]); } } /* for (int i = 0; i < stroopBucket.Count; i++) * { * printStroopItem(stroopBucket[i]); * }*/ // Debug.Log("stroopBucket.Count: " + stroopBucket.Count); stroopItems.Clear(); for (int i = 0; i < numStimuli; i++) { int rndIdx = Random.Range(0, stroopBucket.Count - 1); StroopItem fetchedItemFromBucket = stroopBucket[rndIdx]; stroopBucket.RemoveAt(rndIdx); stroopItems.Add(fetchedItemFromBucket); } /* for (int i = 0; i < numStimuli; i++) * { * printStroopItem(stroopItems[i]); * }*/ }
//Creates congruent or incongruent StroopItem[] void SetCongruent(bool congruent) { //make congruent or incongruent combinations if (congruent) { //Debug.Log("congruent"); combinations = new StroopItem[6]; for (int i = 0; i < combinations.Length; i++) { combinations[i] = new StroopItem(words[i], words[i]); //printStroopItem(combinations[i]); } } else { // Debug.Log("incongruent"); combinations = new StroopItem[30]; int position = 0; for (int j = 0; j < words.Length; j++) { for (int k = 0; k < words.Length; k++) { if (j == words.Length - 1 && k == words.Length - 1) { return; } if (k == j) { k = j + 1; } combinations[position] = new StroopItem(words[j], words[k]); //printStroopItem(combinations[position]); position++; } } } }
//Sets GameObject as Target void SetTarget(StroopItem item) { if (stroopTaskManager.focusTasks[stroopTaskManager.stroopItemIndex] == stroopTaskManager.task[0]) //WORD { for (int i = 0; i < selectables.Length; i++) { if (item.Name == stroopTaskManager.words[i]) { target = selectables[i]; } } } else //COLOR { for (int i = 0; i < selectables.Length; i++) { if (item.ColorString == stroopTaskManager.words[i]) { target = selectables[i]; } } } target.tag = "TARGET"; }
//Debug StroopItem public void printStroopItem(StroopItem item) { Debug.Log("Name: " + item.Name + ", Color: " + item.ColorString); }