Beispiel #1
0
    private bool HighlightWords(string input)
    {
        List <string>     currentWords   = CurrentWord.GetCurrentWords();
        List <GameObject> currentObjects = CurrentWord.GetCurrentWordObjects();
        bool wordFound = false;

        if (currentWords.Count != currentObjects.Count)
        {
            throw new System.Exception("word and object list does not match wtf");
        }

        for (int i = 0; i < currentObjects.Count; i++)
        {
            if (input.Equals(currentWords[i]))
            {
                wordFound = true;
            }
            else if (input.Length <= currentWords[i].Length)
            {
                string checkmatch = currentWords[i].Substring(0, input.Length);
                if (input.Equals(checkmatch))
                {
                    currentObjects[i].GetComponent <WordMovement>().updateHighlighting(input);
                    wordFound = true;
                }
            }
        }

        return(wordFound);
    }
Beispiel #2
0
    private int CheckCurrentWord(string word)
    {
        //Debug.Log(CurrentWord.GetCurrentWords()+":"+word);
        List <string> currentWords = CurrentWord.GetCurrentWords();

        for (int i = 0; i < currentWords.Count; i++)
        {
            if (word == currentWords[i])
            {
                return(i);
            }
        }
        return(-1);
    }