Example #1
0
    private void showQuestion()
    {
        removeAnswerButtons();
        perguntaRespondida = false;
        int random = Random.Range(0, questionPool.Length);

        while (valoresUsados.Contains(random))
        {
            random = Random.Range(0, questionPool.Length);
        }

        QuestionData questionData = questionPool[random];

        valoresUsados.Add(random);
        perguntaAtual      = random;
        textoPergunta.text = questionData.textoPergunta;

        for (int i = 0; i < questionData.respostas.Length; i++)
        {
            GameObject answerButtonGameObject = answerButtonObjectPool.GetObject();
            answerButtonGameObject.transform.SetParent(answerButtonParent);
            answerButtonGameObjects.Add(answerButtonGameObject);
            AnswerButton answerButton = answerButtonGameObject.GetComponent <AnswerButton>();
            answerButton.setup(questionData.respostas[i]);
        }
    }
Example #2
0
    private void repeatQuestion()
    {
        removeAnswerButtons();
        perguntaRespondida = false;

        QuestionData questionData = questionPool[perguntaAtual];

        textoPergunta.text = questionData.textoPergunta;

        for (int i = 0; i < questionData.respostas.Length; i++)
        {
            GameObject answerButtonGameObject = answerButtonObjectPool.GetObject();
            answerButtonGameObject.transform.SetParent(answerButtonParent);
            answerButtonGameObjects.Add(answerButtonGameObject);
            AnswerButton answerButton = answerButtonGameObject.GetComponent <AnswerButton>();
            answerButton.setup(questionData.respostas[i]);
        }
    }