示例#1
0
 //funcão que seleciona a categoria
 public void SelectCategory()
 {
     //pra cada categoria nas categorias
     foreach (CategoryScript category in categoryScripts)
     {
         if (EventSystem.current.currentSelectedGameObject.name == "Aleatorio")
         {
             int random = Random.Range(0, 3);
             currentCategory = categoryScripts[random];
             //enable the game panel
             gamePanel.SetActive(true);
             //disable the menu panel
             menuPanel.SetActive(false);
             //inicializa a primeira palavra
             UpdateWord();
             FullfillList();
             break;
         }
         else if (EventSystem.current.currentSelectedGameObject.name == category.name)
         {
             print("entrou aqui");
             currentCategory = category;
             //enable the game panel
             gamePanel.SetActive(true);
             //disable the menu panel
             menuPanel.SetActive(false);
             //inicializa a primeira palavra
             UpdateWord();
             FullfillList();
             break;
         }
     }
 }
示例#2
0
 //funcão que seleciona a categoria
 public void SelectCategory()
 {
     //pra cada categoria nas categorias
     foreach (CategoryScript category in categoryScripts)
     {
         //Se o nome do objeto clicado for aleatório
         if (EventSystem.current.currentSelectedGameObject.name == "Aleatorio")
         {
             //Sorteia a categoria
             int random = Random.Range(0, categoryScripts.Count);
             currentCategory = categoryScripts[random];
             //enable the game panel
             gamePanel.SetActive(true);
             //disable the menu panel
             menuPanel.SetActive(false);
             //inicializa a primeira palavra
             UpdateWord();
             FullfillList();
             break;
         }
         else if (EventSystem.current.currentSelectedGameObject.name == category.name) //Se o nome do objeto clicado for o nome da categoria X
         {
             //A categoria atual vira a categoria X
             currentCategory = category;
             //enable the game panel
             gamePanel.SetActive(true);
             //disable the menu panel
             menuPanel.SetActive(false);
             //inicializa a primeira palavra
             UpdateWord();
             FullfillList();
             break;
         }
     }
 }
示例#3
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();
        }
    }
示例#4
0
    public void ShowWords()
    {
        inputFieldEditCategoryName.text = EventSystem.current.currentSelectedGameObject.name;
        currentCategory = GameObject.Find(inputFieldEditCategoryName.text).GetComponentInChildren <CategoryScript>();

        foreach (string word in currentCategory.words)
        {
            TMP_InputField currentWord = Instantiate(inputFieldEditCategoryWord);
            currentWord.transform.SetParent(changes.transform);
            currentWord.text = word;
        }
    }
示例#5
0
    public void SetNewCategory()
    {
        currentCategory = Instantiate(categoryPrefab);
        currentCategory.transform.SetParent(categories.transform);
        currentCategory.name = inputFieldCategoryName.text;
        CategoryScript category = currentCategory.GetComponentInChildren <CategoryScript>();
        Text           text     = currentCategory.GetComponentInChildren <Text>();

        category.gameObject.name = currentCategory.gameObject.name;
        text.text = currentCategory.gameObject.name;

        gm.categoryScripts.Add(category);
    }