blob: 5c8835c94fb1276163364d03769ab3bec08bae0e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Castle : MonoBehaviour {
private void Update () {
//CheckThing();
}
private void CheckThing() {
GameObject[] enemies = GameObject.FindGameObjectsWithTag ("enemy");
foreach (var enemy in enemies) {
var distanceToEnemy = Vector3.Distance (transform.position, enemy.transform.position);
if (distanceToEnemy <= 0) {
Debug.Log("INTRUDER!");
}
}
}
}
|