Beispiel #1
0
    //function to check if the word has alredy been discovered
    public void VerifyFullWord()
    {
        //if every letter was found
        if (discoveredLetters == word.Length)
        {
            //sum points
            scoreTotal += wordPoint;
            //update score
            scoreUI.text = scoreTotal.ToString();
            //saves the score
            saveData.SaveScore(scoreTotal);
            //reset the discovered letters
            discoveredLetters = 0;

            //Se não terminou todas as palavras da categoria
            if (index != currentCategory.words.Count)
            {
                //reset the discovered letters
                correctLetters.Clear();
                correctLetters.TrimExcess();
                wrongLettersUI.text = "";
                //update word
                UpdateWord();
                //Enable the Toy
                toy.EnableToy();
                //reset the parts
                partToDisable = 0;
                //activate the button to the next word
                nextWordButton.SetActive(true);
            }
            else //Se ja terminou as palavras
            {
                //Enable the Toy
                toy.EnableToy();
                //reset the parts
                partToDisable = 0;
                //reset the discovered letters
                correctLetters.Clear();
                correctLetters.TrimExcess();
                wrongLettersUI.text = "";
                //update word
                ClearList();
                //reset chances
                chances = startChances;
                //clear list of wrong words
                wrongLetters.Clear();
                wrongLetters.TrimExcess();
                currentCategory = null;
                word            = null;
                DeletePreviousWord();
                //enable the category won panel
                categoryWonPanel.SetActive(true);
                index = 0;
            }
            //pause the game
            SceneScript.PauseGame();
        }
    }