using System.Collections; using System.Collections.Generic; using System.Runtime.InteropServices; using UnityEngine; using UnityEngine.UI; public class ControlQuestions_274 : MonoBehaviour { private Text Op1, Op2, Op3; private int Etapa = 0; private bool Ended = false; public int Lifes; private Text LifeText; public List Questoes; public Animator WinPanel, LostPanel, MainAnime; [System.Serializable] public class Opcao { public string Questao1, Questao2, Questao3, Certo; } // Start is called before the first frame update void Start() { //WinPanel = GameObject.Find("YouWinPanel").GetComponent(); //LostPanel = GameObject.Find("GameOverPanel").GetComponent(); Op1 = GameObject.Find("TextOp1").GetComponent(); Op2 = GameObject.Find("TextOp2").GetComponent(); Op3 = GameObject.Find("TextOp3").GetComponent(); LifeText = GameObject.Find("Lifes").GetComponent(); LifeText.text = "0" + Lifes.ToString(); Op1.text = Questoes[Etapa].Questao1; Op2.text = Questoes[Etapa].Questao2; Op3.text = Questoes[Etapa].Questao3; } // Update is called once per frame void Update() { } public void VerificaResposta(Text Answer) { if (!Ended) { if (Answer.text == Questoes[Etapa].Certo) { if ((Etapa + 1) == Questoes.Count) { Ended = true; } else { Etapa++; Op1.text = Questoes[Etapa].Questao1; Op2.text = Questoes[Etapa].Questao2; Op3.text = Questoes[Etapa].Questao3; MainAnime.SetInteger("Etapa", MainAnime.GetInteger("Etapa") + 1); } } else { Answer.text = "Wrong"; Lifes--; LifeText.text = "0" + Lifes.ToString(); if (Lifes == 0) { Ended = true; } } } } }