Exemplo n.º 1
0
    void AddAnswer(string value, GameObject prefab, int currentScenario)
    {
        //Returns from the method so the player is unable to press more buttons than intended
        if (answerFound || prefab.GetComponent <ButtonPressed>().hasBeenPressed)
        {
            return;
        }

        playerResponse[clickCount].GetComponent <TextMeshPro>().text      = value;
        playerResponse[clickCount].GetComponent <TextMeshPro>().fontStyle = FontStyles.Underline;
        prefab.GetComponent <ButtonPressed>().ButtonWasPressed();

        if (currentScenario == 0)
        {
            if (value == "He")
            {
                narrator.pronoun = "Dad";
            }
            else if (value == "She")
            {
                narrator.pronoun = "Mum";
            }
            else if (value == "They")
            {
                narrator.pronoun = "Tata";
            }
            narrator.AddPronoun();
            answerFound = true;
            StartCoroutine(Delay(1f, 1));
            return;
        }
        else if (currentScenario == 19)
        {
            answerFound = true;

            if (value == "Ring")
            {
                StartCoroutine(Delay(1f, 2));
            }
            else if (value == "Wait")
            {
                StartCoroutine(Delay(1f, 1));
            }
            return;
        }

        //a counter is used to check the sentence the player created with the correct answer
        clickCount++;

        if (clickCount == narrator.correctAnswers[currentScenario].Length)
        {
            CheckAnswers(currentScenario);
        }
    }