/// <summary> /// /// </summary> protected void GetAndCreateWords() { //string[] wordsFromXml = GameFunctions.GetTextXML(challengeTypeString, "WORDS", "word"); //string[] lettersFromXml = GameFunctions.GetTextXML(challengeTypeString, "LETTERS", "letter"); char[] lettersToFilter = challengeTypeString.ToCharArray(); string[] lettersToFilterString = new string[lettersToFilter.Length]; for (int i = 0; i < lettersToFilterString.Length; i++) { lettersToFilterString[i] = lettersToFilter[i].ToString(); } Debug.Log(lettersToFilterString[0]); //WordsWithLetters wordsWithLetters = GetWords(lettersToFilterString); //WordsWithLetters wordsWithLetters = GetWords2(lettersToFilterString, (int)gameManager.infoType[ChallengeType.ZCS].Difficulty); WordsWithLetters wordsWithLetters = GetWords2(lettersToFilterString, 10); string[] wordsToUse = wordsWithLetters.words; string[] lettersToUse = wordsWithLetters.letters; int auxInt = 0; wordObjects = new List <WordInfo>(); wordsInScreen = new Queue <WordInfo>(4); foreach (string s in wordsToUse) { WordInfo aux = Instantiate(wordPrefab).GetComponent <WordInfo>(); aux.Word = s; aux.Letter = lettersToUse[auxInt]; aux.GetComponent <TextMesh>().text = aux.Word; aux.gameObject.SetActive(false); wordObjects.Add(aux); auxInt++; } AddWordInScreen(); }
/// <summary> /// /// </summary> protected void GetAndCreateWords() { char[] lettersToFilter = challengeTypeString.ToCharArray(); string[] lettersToFilterString = new string[lettersToFilter.Length]; for (int i = 0; i < lettersToFilterString.Length; i++) { lettersToFilterString[i] = lettersToFilter[i].ToString(); } // Debug.Log(lettersToFilterString[0]); //WordsWithLetters wordsWithLetters = GetWords(lettersToFilterString); //WordsWithLetters wordsWithLetters = GetWords2(lettersToFilterString, (int)gameManager.infoType[ChallengeType.ZCS].Difficulty); WordsWithLetters wordsWithLetters = GetWords2(lettersToFilterString, 10); string[] wordsToUse = wordsWithLetters.words; string[] lettersToUse = wordsWithLetters.letters; int auxInt = 0; wordObjects = new List <WordInfo>(); wordsInScreen = new Queue <WordInfo>(4); foreach (string s in wordsToUse) { WordInfo aux = Instantiate(wordPrefab).GetComponent <WordInfo>(); //WordInfo aux = Instantiate(wordPrefab, new Vector3(0, 10, 0), Quaternion.identity).GetComponent<WordInfo>(); aux.Word = s; aux.Points = 10; aux.Letter = lettersToUse[auxInt]; aux.GetComponent <TextMesh>().text = aux.Word; aux.gameObject.SetActive(false); wordObjects.Add(aux); auxInt++; } AddWordInScreen(); }