private void ShowQuestion()
    {
        questionPanel.SetActive(true);
        nextButton.SetActive(false);
        explanationButton.SetActive(false);

        questionIndex = Random.Range(0, questionPool.Length);

        RemoveAnswerButtons();
        canAnswer = true;

        QuestionData questionData = questionPool[questionIndex];

        questionDisplayText.text = questionData.questionText;

        for (int i = 0; i < questionData.answers.Length; i++)
        {
            GameObject answerButtonGameObject = answerButtonObjectPool.GetObject();
            answerButtonGameObjects.Add(answerButtonGameObject);
            answerButtonGameObject.transform.SetParent(answerButtonParent);


            AnswerButton answerButton = answerButtonGameObject.GetComponent <AnswerButton>();
            answerButton.GetComponent <Image>().color = new Color32(255, 255, 255, 50);
            answerButton.Setup(questionData.answers[i]);
        }
    }
Exemplo n.º 2
0
    public void OnGameEnd()
    {
        targetQuestionCardScript.SetQuestionText(" ");
        targetQuestionCardScript.SetTitleText(" ");
        targetQuestionCardScript.SetCounterText(" ");

        foreach (OptionCard AnswerButton in gameObjectButtonList)
        {
            AnswerButton.SetOptionCardQuestion(" ", false);
            AnswerButton.GetComponent <Image>().sprite = SpriteManager.instance.GetSpriteByName("OptionButton");
        }
    }