private void GenerateWords() { foreach (var word in words) { var formattedWord = FormatWord(word); GameObject wordObject; if (PronounValues.GetWrongPronouns1().Contains(formattedWord)) { wordObject = Instantiate(pronounPrefab1); formNavigator.inputs.Add(wordObject); } else if (PronounValues.GetWrongPronouns2().Contains(formattedWord)) { wordObject = Instantiate(pronounPrefab2); formNavigator.inputs.Add(wordObject); } else { wordObject = Instantiate(wordPrefab); } wordObject.GetComponent <TMPro.TextMeshProUGUI>().text = word; wordGrid.Add(wordObject); } formNavigator.inputs.Add(GameObject.Find("NextSceneArrowButton")); GenerateGrid(); }
private void CorrectAllPronouns() { GameObject[] speechBubbles = GameObject.FindGameObjectsWithTag("Speech"); foreach (var speech in speechBubbles) { string speechText = speech.GetComponentInChildren <TMPro.TextMeshProUGUI> ().text; speechText = speechText.Replace(PronounValues.GetWrongPronouns1() [1], PronounValues.GetRightPronoun1()); speechText = speechText.Replace(PronounValues.GetWrongPronouns2() [1], PronounValues.GetRightPronoun2()); speech.GetComponentInChildren <TMPro.TextMeshProUGUI> ().text = speechText; } formNavigator.inputs.Add(GameObject.Find("NextSceneArrowButton")); }
//TODO choose a random set of wrong pronouns? public static List <string> AddWrongPronounsToArray(string[] copyList) { List <string> newCopyList = new List <string>(); foreach (var text in copyList) { string newText = ""; newText = text.Replace("(wrongPronoun1)", PronounValues.GetWrongPronouns1()[1]); newText = newText.Replace("(wrongPronoun2)", PronounValues.GetWrongPronouns2()[1]); newCopyList.Add(newText); } return(newCopyList); }
public static string AddWrongPronounsToString(string copy) { return(copy.Replace("(wrongPronoun1)", PronounValues.GetWrongPronouns1()[1]) .Replace("(wrongPronoun2)", PronounValues.GetWrongPronouns2()[1])); }