56 lines
1.9 KiB
C#
56 lines
1.9 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class ControllerButtonsMakeSalad : MonoBehaviour
|
|
{
|
|
public GameObject btnbanana, btnwater, btnmamao, btnkiwi, btnorange, btnapple, btnlemon, btnmorang, btnpera;
|
|
public GameObject btnavancar, btnvoltar;
|
|
public Animator end_Anim;
|
|
public static bool finishedGame = false;
|
|
public static bool ended = false;
|
|
void Start()
|
|
{
|
|
int index = 0;
|
|
ended = false;
|
|
finishedGame = false;
|
|
GameControl jooj = GameObject.Find("GameControl").GetComponent<GameControl>();
|
|
jooj.ended = false;
|
|
jooj.finishedGame = false;
|
|
jooj.failedGame = false;
|
|
btnvoltar.SetActive(false);
|
|
btnapple.SetActive(false); btnlemon.SetActive(false); btnmorang.SetActive(false); btnpera.SetActive(false);
|
|
}
|
|
|
|
public void btnVoltar()
|
|
{
|
|
btnvoltar.SetActive(false);
|
|
btnbanana.SetActive(true); btnwater.SetActive(true); btnkiwi.SetActive(true); btnorange.SetActive(true);btnmamao.SetActive(true);
|
|
btnapple.SetActive(false); btnlemon.SetActive(false); btnmorang.SetActive(false); btnpera.SetActive(false);
|
|
btnavancar.SetActive(true);
|
|
}
|
|
public void btnAvancar()
|
|
{
|
|
btnvoltar.SetActive(true);
|
|
btnbanana.SetActive(false); btnwater.SetActive(false); btnkiwi.SetActive(false); btnorange.SetActive(false);btnmamao.SetActive(false);
|
|
btnapple.SetActive(true); btnlemon.SetActive(true); btnmorang.SetActive(true); btnpera.SetActive(true);
|
|
btnavancar.SetActive(false);
|
|
}
|
|
|
|
public void EndGame()
|
|
{
|
|
end_Anim.SetTrigger("Endgame");
|
|
StartCoroutine(espera(4));
|
|
}
|
|
void win()
|
|
{
|
|
GameControl jooj = GameObject.Find("GameControl").GetComponent<GameControl>();
|
|
jooj.finishedGame = true;
|
|
}
|
|
IEnumerator espera(float wait)
|
|
{
|
|
yield return new WaitForSeconds(wait);
|
|
win();
|
|
}
|
|
}
|