using System.Collections; using TMPro; using UnityEngine; using UnityEngine.UI; public class QuizPopUp : Menu { [Header("Questions")] [SerializeField] TextMeshProUGUI questionText; [SerializeField] QuestionSO currentQuestion; [Header("Answers")] [SerializeField] private Sprite normalButttonSprite; [SerializeField] private Sprite trueAnswerSprite; [SerializeField] private Sprite falseAnswerSprite; [SerializeField] GameObject[] answerButtons; int correctAnswerIndex; bool hasAnsweredEarly; [Header("Timer")] [SerializeField] Image timerImage; [SerializeField] TextMeshProUGUI timerText; public GameManager gameManager; public bool isComplete = false; bool isGameOver = false; //======================== [SerializeField] float timeToCompleteQuestion = 30f; [SerializeField] float timeToShowCorrectAnswer = 10f; public bool loadNextQuestion; public float fillFraction; public bool isAnsweringQuestion; float timerValue; private void OnEnable() { gameManager = FindObjectOfType(); if (gameManager == null) return; currentQuestion = gameManager.currentQuestion; correctAnswerIndex = currentQuestion.answerIndex; timerValue = timeToCompleteQuestion; isAnsweringQuestion = true; fillFraction = 1f; loadNextQuestion = false; hasAnsweredEarly = false; isComplete = false; SetButtonState(true); DisplayQuestion(); PlayDubbingQuestion(); audioController.Instance.bgmSource.volume = .1f; } private void OnDisable() { isAnsweringQuestion = false; hasAnsweredEarly = false; loadNextQuestion = false; isComplete = false; fillFraction = 1f; timerValue = 0f; questionText.text = ""; for (int i = 0; i < answerButtons.Length; i++) { Button button = answerButtons[i].GetComponent