80 lines
2.2 KiB
C#
80 lines
2.2 KiB
C#
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<Opcao> 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<Animator>();
|
|
//LostPanel = GameObject.Find("GameOverPanel").GetComponent<Animator>();
|
|
|
|
Op1 = GameObject.Find("TextOp1").GetComponent<Text>();
|
|
Op2 = GameObject.Find("TextOp2").GetComponent<Text>();
|
|
Op3 = GameObject.Find("TextOp3").GetComponent<Text>();
|
|
|
|
|
|
LifeText = GameObject.Find("Lifes").GetComponent<Text>();
|
|
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; }
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|