/********************** ********LAVID********** ***VLibras Project***** *------------------------------------------------------------------------ *Description: * * Controls screens transactions (back button) * *------------------------------------------------------------------------ **Author: Claudiomar Araujo *claudiomar.araujo@lavid.ufpb.br */ using UnityEngine; using System.Collections; using System.Threading; public class ScreenReferences : MonoBehaviour { // tutorials public GameObject infos; public GameObject t_1; public GameObject t_2; public GameObject t_3; public GameObject t_4; public GameObject t_5; public BoxCollider collider; public GameObject text_entry; public GameObject i_bar; public PlayerManager player_manager; private static bool HOME_SCREEN; void Update() { if (Input.GetKey(KeyCode.Escape)) { if(HOME_SCREEN) { Application.Quit(); } else { BackToHomeScreen(); } Thread.Sleep(500); } } void Start() { HOME_SCREEN = true; collider = GameObject.FindGameObjectWithTag("avatar").GetComponent(); } void BackToHomeScreen() { collider.enabled = true; HOME_SCREEN = true; if(infos.activeSelf) { infos.SetActive(false); } if(t_1.activeSelf) { t_1.SetActive(false); } if(t_2.activeSelf) { t_2.SetActive(false); } if(t_3.activeSelf) { t_3.SetActive(false); } if(t_4.activeSelf) { t_4.SetActive(false); } if(t_5.activeSelf) { t_5.SetActive(false); } if(!i_bar.activeSelf) { i_bar.SetActive(true); } if(text_entry.activeSelf) { text_entry.SetActive(false); } } public void setHomeScreen(bool value) { HOME_SCREEN = value; } }