void NextQuestion() { _currentQuestion = _currentCollection.NextQuestion(); UpdateImage(); UpdateText(); UpdateBtns(); anim.Play("NewQuestion"); }
void ShuffleArray(QuestionSO[] inputArray) { for (int i = inputArray.Length - 1; i > 0; i--) { int randomIndex = Random.Range(0, i + 1); QuestionSO temp = inputArray[i]; inputArray[i] = inputArray[randomIndex]; inputArray[randomIndex] = temp; } }
void SetQuestion(int questionIndex = -1) { int index = questionIndex != -1 ? questionIndex : currentQuestionIndex; QuestionSO currentQuestion = temporaryQuestions[index]; button1.GetComponentInChildren <Text>().text = currentQuestion.answer1; button2.GetComponentInChildren <Text>().text = currentQuestion.answer2; button3.GetComponentInChildren <Text>().text = currentQuestion.answer3; button4.GetComponentInChildren <Text>().text = currentQuestion.answer4; questionImage.sprite = currentQuestion.image; questionText.text = currentQuestion.question; button1.gameObject.SetActive(true); button2.gameObject.SetActive(true); button3.gameObject.SetActive(true); button4.gameObject.SetActive(true); }