using System.Collections;
using System.Collections.Generic;
using UnityEngine.SceneManagement;
public class GameManager : MonoBehaviour {
public Question[] questios;
private Question currentQuestion;
private static List<Question> unansweredQuestions;
private Text trueAnswertext;
private Text falseAnswertext;
private Image QuestionImage;
private float timeBetweenScenes = 1f;
private Animator animator;
if (unansweredQuestions == null || unansweredQuestions.Count==0)
unansweredQuestions = questios.ToList<Question>() ;
void SetCurrentQuestion() {
int randomQuestionIndex = Random.Range(0, unansweredQuestions.Count);
currentQuestion = unansweredQuestions[randomQuestionIndex];
factText.text = currentQuestion.fact;
QuestionImage.sprite = currentQuestion.image;
unansweredQuestions.RemoveAt(randomQuestionIndex);
if (currentQuestion.isTrue) {
trueAnswertext.text = "HELYES";
falseAnswertext.text = "HELYTELEN";
trueAnswertext.text = "HELYTELEN";
falseAnswertext.text = "HELYES";
IEnumerator TransitionToNextQuestion()
unansweredQuestions.Remove(currentQuestion);
yield return new WaitForSeconds(timeBetweenScenes);
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
public void UserSelectTrue() {
animator.SetTrigger("True");
if (currentQuestion.isTrue)
Debug.Log("Nem helyes!");
StartCoroutine(TransitionToNextQuestion());
public void UserSelectFalse() {
animator.SetTrigger("False");
if (!currentQuestion.isTrue)
Debug.Log("Nem helyes!");
StartCoroutine(TransitionToNextQuestion());