void SelectedQuestion()
 {
     if (questions.Count > 0)
     {
         selectedQuestion = questions.Dequeue();
         quizUI.SetQuestion(selectedQuestion);
     }
 }
Beispiel #2
0
    void SelectQuestion()
    {
        int val = UnityEngine.Random.Range(0, questions.Count);

        selectedQuestion = questions[val];

        quizUI.SetQuestion(selectedQuestion);
        questions.RemoveAt(val);
    }
Beispiel #3
0
    void SelectQuestion() //Selects a random question then removes it so the player cant get it again
    {
        int val = UnityEngine.Random.Range(0, questions.Count);

        selectedQuestion = questions[val];

        quizUI.SetQuestion(selectedQuestion);

        questions.RemoveAt(val);
    }
    //chooses next question
    void ChooseQuestion()
    {
        //random with repeat on used indexes
        bool lookForUnusedQuestionFlag = true;

        while (lookForUnusedQuestionFlag)
        {
            int questionIndex = Random.Range(0, questions.Count);
            if (questions[questionIndex].alreadyUsed == false)
            {
                questions[questionIndex].alreadyUsed = true;
                currentQuestion = questions[questionIndex];
                quizUI.SetQuestion(currentQuestion);
                lookForUnusedQuestionFlag = false;
            }
        }
    }