ScreenReferences.cs
1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/**********************
********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<BoxCollider>();
}
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;
}
}