96 lines
2.5 KiB
C#
96 lines
2.5 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
|
|
public class CheckWinMaterials : MonoBehaviour
|
|
{
|
|
public static bool finishedGame = false, ended = false;
|
|
int index = 0;
|
|
private int pointstoWin, currentPoints;
|
|
public GameObject container, tutorial, stage1, stage2, stage3, buttonWin, bag1, bag2;
|
|
public int nmberItens;
|
|
public static int stage;
|
|
public Text textStage;
|
|
|
|
|
|
void Start()
|
|
{
|
|
StartCoroutine(WaitForDownload());
|
|
}
|
|
|
|
IEnumerator WaitForDownload()
|
|
{
|
|
while(GamesResourcesFinder.instance.gameReady == false)
|
|
{
|
|
yield return new WaitForEndOfFrame();
|
|
}
|
|
yield return new WaitForSeconds(.2f);
|
|
|
|
int index = 0;
|
|
ended = false;
|
|
finishedGame = false;
|
|
#region
|
|
GameControl jooj = GameObject.Find("GameControl").GetComponent<GameControl>();
|
|
jooj.ended = false;
|
|
jooj.finishedGame = false;
|
|
jooj.failedGame = false;
|
|
|
|
#endregion
|
|
stage2.SetActive(false); stage3.SetActive(false);
|
|
textStage = GameObject.Find("TxtStage").GetComponent<Text>();
|
|
buttonWin.SetActive(false);
|
|
bag1.SetActive(false);
|
|
}
|
|
void Update()
|
|
{
|
|
Debug.Log(currentPoints);
|
|
|
|
//My materials: 2 Pencils, Pen, Eraser, Scissors and Sharpener.
|
|
if (currentPoints == 7)
|
|
{
|
|
bag2.SetActive(false);
|
|
stage = 2;
|
|
stage1.SetActive(false);
|
|
stage2.SetActive(true);
|
|
textStage.text = "MATCH THE SCHOOL SUPPLIES: Pencil, Pen, Sharpener, Stapler, Ruler, Eraser, Glue and Scissors";
|
|
}
|
|
else if (currentPoints == 16)
|
|
{
|
|
|
|
stage = 3;
|
|
stage2.SetActive(false);
|
|
stage3.SetActive(true);
|
|
textStage.text = "My school Supplies";
|
|
}
|
|
else if(currentPoints >= 17)
|
|
{
|
|
buttonWin.SetActive(true);
|
|
}
|
|
else if(currentPoints == 6)
|
|
{
|
|
bag1.SetActive(true);
|
|
}
|
|
else if (currentPoints == 15)
|
|
{
|
|
bag2.SetActive(true);
|
|
}
|
|
}
|
|
|
|
public void AddPoints()
|
|
{
|
|
currentPoints++;
|
|
}
|
|
public void win()
|
|
{
|
|
GameControl jooj = GameObject.Find("GameControl").GetComponent<GameControl>();
|
|
jooj.finishedGame = true;
|
|
}
|
|
void Lost()
|
|
{
|
|
//GameControl jooj = GameObject.Find("GameControl").GetComponent<GameControl>();
|
|
// jooj.failedGame = true;
|
|
}
|
|
}
|