Beispiel #1
0
        private IEnumerator ShowNextQuestionCoroutine()
        {
            yield return(new WaitForSeconds(AnswerShowTime));

            CurrentQuestion++;
            if (CurrentQuestion > m_QuizQuestions.Count - 1)
            {
                QuizEvents.QuizFinishedEvent(m_Points);
            }
            else
            {
                UIController.SetupUIForQuestion(m_QuizQuestions[CurrentQuestion]);
            }
        }
Beispiel #2
0
        public void SubmitAnswer(int answerNumber)
        {
            bool isCorrect = answerNumber == m_QuizQuestions[CurrentQuestion].CorrectAnswer;

            if (isCorrect)
            {
                QuizEvents.AnswerCorrectEvent(answerNumber);
                m_Points++;
            }
            else
            {
                QuizEvents.AnswerIncorrectEvent(m_QuizQuestions[CurrentQuestion].CorrectAnswer, answerNumber);
            }
            ShowNextQuestion();
        }
Beispiel #3
0
        private void Update()
        {
            if (!m_Running)
            {
                return;
            }

            if (m_CurrentTime >= m_MaxTime)
            {
                StopTimer();
                m_Slider.value = 1f;
                QuizEvents.TimeOutEvent();
                return;
            }

            m_Slider.value = m_CurrentTime / m_MaxTime;
            m_CurrentTime += Time.unscaledDeltaTime;
        }