-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathObstacleTg_K.cs
37 lines (35 loc) · 966 Bytes
/
ObstacleTg_K.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
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ObstacleTg_K : MonoBehaviour
{
AntMove antmove;
void Awake()
{
antmove = GameObject.Find("ant").GetComponent<AntMove>();
}
void OnTriggerEnter(Collider col)
{
if (col.tag == "Bark" || col.tag == "Worm" || col.tag == "Hole" || col.tag == "AntFriend")
{
antmove.btn[4, 0] = 0;
}
}
void OnTriggerStay(Collider col)
{
if (col.tag == "Bark" || col.tag == "Worm" || col.tag == "Hole" || col.tag == "AntFriend")
{
antmove.btn[4, 0] = 0;
}
}
void OnTriggerExit(Collider col)
{
if (col.tag == "Bark" || col.tag == "Worm" || col.tag == "Hole" || col.tag == "AntFriend")
{
if (Input.GetKey(KeyCode.K))
{
antmove.btn[4, 0] = 1;
}
}
}
}