-
Notifications
You must be signed in to change notification settings - Fork 0
/
Quest.cs
46 lines (41 loc) · 1.07 KB
/
Quest.cs
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
using UnityEngine;
using System.Collections;
public class Quest : MonoBehaviour {
[SerializeField]
bool showObjective = false;
[SerializeField]
Texture objective;
[SerializeField]
private int collision;
void Start()
{
showObjective = false;
}
void OnTriggerEnter(Collider other)
{
if (other.gameObject.tag == "Player" && showObjective == false && collision == 0)
showObjective = true;
}
void OnTriggerExit(Collider other)
{
if (other.gameObject.tag == "Player")
showObjective = false;
collision = 1;
}
void OnGUI()
{
if (showObjective == true)
GUI.DrawTexture(new Rect(Screen.width / 1.5f, Screen.height / 1.4f, 178, 178), objective);
}
void Update()
{
if (Input.GetButton("ShowObj")&& collision == 1)
{
showObjective = true;
}
if (Input.GetButtonUp("ShowObj") && collision == 1)
{
showObjective = false;
}
}
}