예제 #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);
    }
 public static void PlayerMistake()
 {
     audio.Play();
     foreach (var ob in CurrentWord.GetCurrentWordObjects())
     {
         ob.GetComponent <WordMovement>().Mistake();
     }
 }