-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDestroyOnClick.cs
More file actions
54 lines (50 loc) · 1.42 KB
/
DestroyOnClick.cs
File metadata and controls
54 lines (50 loc) · 1.42 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
using UnityEngine;
using System.Collections;
public class DestroyOnClick : MonoBehaviour {
public ExtinctionProgress script1;
public ExtinctionProgress script2;
public ExtinctionProgress script3;
public ExtinctionProgress script4;
public ExtinctionProgress script5;
public GameObject obj1;
public GameObject obj2;
public GameObject obj3;
public GameObject obj4;
public GameObject obj5;
// Use this for initialization
void Start ()
{
}
// Update is called once per frame
void Update ()
{
if (Input.GetMouseButtonDown(0) | Input.GetKeyDown("joystick button 2"))
{
if (script1.inRange)
{
DestroyObject(obj1);
script1.objectiveCleared = true;
}
if (script2.inRange)
{
DestroyObject(obj2);
script2.objectiveCleared = true;
}
if (script3.inRange)
{
DestroyObject(obj3);
script3.objectiveCleared = true;
}
if (script4.inRange)
{
DestroyObject(obj4);
script4.objectiveCleared = true;
}
if (script5.inRange)
{
DestroyObject(obj5);
script5.objectiveCleared = true;
}
}
}
}