-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathObstaclePrefab
171 lines (148 loc) · 3.53 KB
/
ObstaclePrefab
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
//AntFriendMove
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class AntFriendMove : MonoBehaviour
{
AntMove Ant;
public float time = 60.0f;
void Start()
{
Ant = GameObject.Find("ant").GetComponent<AntMove>();
List<float> agx = new List<float>();
List<float> agy = new List<float>();
agx.Add(90.0f);
agx.Add(-90.0f);
agy.Add(0.0f);
agy.Add(180.0f);
int id = Random.Range(0, 2);
if (id == 1)
{
this.gameObject.transform.position = new Vector3(this.gameObject.transform.position.x - 1.1f, this.gameObject.transform.position.y, this.gameObject.transform.position.z);
}
this.gameObject.transform.eulerAngles = new Vector3(agx[id], agy[id], 0.0f);
//StartCoroutine(DestroySelf());
}
void Update()
{
if (Ant.chk == 1)
{
Destroy(gameObject);
}
}
void OnTriggerStay(Collider col)
{
if (col.tag == "Worm" || col.tag == "Bark" || col.tag == "AntFriend")
{
Destroy(gameObject);
}
}
IEnumerator DestroySelf()
{
yield return new WaitForSeconds(time);
Destroy(this.gameObject);
}
}
//BarkMove
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BarkMove : MonoBehaviour
{
AntMove Ant;
public float time = 60.0f;
void Start()
{
Ant = GameObject.Find("ant").GetComponent<AntMove>();
//StartCoroutine(DestroySelf());
}
// Update is called once per frame
void Update()
{
if (Ant.chk == 1)
{
Destroy(gameObject);
}
}
void OnTriggerStay(Collider col)
{
if (col.tag == "Bark" || col.tag == "Worm" || col.tag == "Hole")
{
Destroy(gameObject);
}
}
IEnumerator DestroySelf()
{
yield return new WaitForSeconds(time);
Destroy(this.gameObject);
}
}
//HoleMove
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class HoleMove : MonoBehaviour
{
AntMove Ant;
public float time = 60.0f;
void Start()
{
Ant = GameObject.Find("ant").GetComponent<AntMove>();
//StartCoroutine(DestroySelf());
}
// Update is called once per frame
void Update()
{
if (Ant.chk == 1)
{
Destroy(gameObject);
}
}
void OnTriggerStay(Collider col)
{
if (col.tag == "Hole" || col.tag == "AntFriend")
{
Destroy(gameObject);
}
}
IEnumerator DestroySelf()
{
yield return new WaitForSeconds(time);
Destroy(this.gameObject);
}
}
//WormMove
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class WormMove : MonoBehaviour
{
AntMove Ant;
public float time = 60.0f;
void Start()
{
Ant = GameObject.Find("ant").GetComponent<AntMove>();
float x = Random.Range(0.0f, 360.0f);
this.gameObject.transform.eulerAngles = new Vector3(x, 90.0f, 90.0f);
// StartCoroutine(DestroySelf());
}
void Update()
{
if (Ant.chk == 1)
{
Destroy(gameObject);
}
}
void OnTriggerStay(Collider col)
{
if (col.tag == "Worm" || col.tag == "Hole")
{
Destroy(gameObject);
}
}
IEnumerator DestroySelf()
{
yield return new WaitForSeconds(time);
Destroy(this.gameObject);
}
}