public void SetQuestion(QuizManager.Question question)
    {
        this.question     = question;
        questionText.text = question.questionInfo;
        int index = quizManager.HowManyAnswered() + 1;

        questionIndex.text = index.ToString();

        //shuffles answer options randomly
        List <string> answerList = ShuffleList.ShuffleListItems <string>(question.options);

        for (int i = 0; i < options.Count; i++)
        {
            options[i].GetComponentInChildren <Text>().text = answerList[i];
            options[i].name        = answerList[i];
            options[i].image.color = normal;
        }

        answered = false;
    }
Example #2
0
  public void SetQuestion(QuizManager.Question question)
  {
      this.question = question;
      switch (question.questionType)
      {
      case QuizManager.QuestionType.TEXT:
          questionImage.transform.parent.gameObject.SetActive(false);
          break;

      case QuizManager.QuestionType.IMAGE:
          ImageHolder();
          questionImage.transform.gameObject.SetActive(true);
          questionImage.sprite = question.questionImg;
          break;

      case QuizManager.QuestionType.VIDEO:
          ImageHolder();
          questionVideo.transform.gameObject.SetActive(true);
          questionVideo.clip = question.questionVideo;
          questionVideo.Play();
          break;

      case QuizManager.QuestionType.AUDIO:
          ImageHolder();
          questionAudio.transform.gameObject.SetActive(true);
          break;
      }

      questionText.text = question.questionInfo;
      List <string> answerList = ShuffleList.ShuffleListItems <string>(question.options);


      for (int i = 0; i < options.Count; i++)
      {
          options[i].GetComponentInChildren <Text>().text = answerList[i];
          options[i].name        = answerList[i];
          options[i].image.color = normalColor;
      }

      answered = false;
  }