Exemplo n.º 1
0
    public void TypeLetter(char letter)
    {
        if (hasActiveWord)
        {
            //check if letter was next
            //remove it from the word
            if (activeWord.GetNextLetter() == letter)
            {
                activeWord.TypeLetter();
            }
        }
        else
        {
            foreach (LRWord word in words)
            {
                if (word.GetNextLetter() == letter)
                {
                    activeWord    = word;
                    hasActiveWord = true;
                    word.TypeLetter();
                    break;
                }
            }
        }

        if (hasActiveWord && activeWord.WordTyped())
        {
            hasActiveWord = false;
            words.Remove(activeWord);
        }
    }
Exemplo n.º 2
0
    public void TypeLetter(char letter)
    {
        if (hasActiveWord)
        {
            //check if letter was next
            //remove it from the word
            if (activeWord.GetNextLetter() == letter)
            {
                PlayFeedbackSound(AudioClipType.GoodLetter);
                activeWord.TypeLetter();
            }
            else
            {
                PlayFeedbackSound(AudioClipType.BadLetter);
            }
        }
        else
        {
            //foreach(char c in Input.inputString)
            foreach (LRWord word in words)
            {
                if (word.GetNextLetter() == letter)
                {
                    //_inputChar = c;
                    activeWord    = word;
                    hasActiveWord = true;
                    PlayFeedbackSound(AudioClipType.GoodLetter);
                    word.TypeLetter();
                    PlayFeedbackSound(AudioClipType.GoodWord);
                    break;
                }
                else if (word.GetNextLetter() != letter /*&& hasActiveWord==false*/)
                {
                    PlayFeedbackSound(AudioClipType.BadLetter);
                }
            }
            if (hasActiveWord == false)
            {
                PlayFeedbackSound(AudioClipType.BadLetter);
            }
        }

        if (hasActiveWord && activeWord.WordTyped())
        {
            hasActiveWord = false;
            PlayFeedbackSound(AudioClipType.GoodWord);
            words.Remove(activeWord);
            SceneManager.LoadScene("LR_Game_Passed");
        }
    }