-
Notifications
You must be signed in to change notification settings - Fork 0
/
gizmo.cs
56 lines (38 loc) · 913 Bytes
/
gizmo.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
47
48
49
50
51
52
53
54
55
56
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class gizmo : MonoBehaviour {
public Color color = new Color(0.985f, 0.022f, 0.022f, 0.2f);
public List<GameObject> targets = new List<GameObject>();
public Vector3 size = new Vector3(1,1,0);
void OnDrawGizmos()
{
Gizmos.color = color;
Gizmos.DrawCube(transform.position, size);
if (targets.Count > 0 )
{
for (int i = 0; i < targets.Count; i++)
{
Gizmos.DrawLine(transform.position, targets[i].transform.position);
}
}
}
public GameObject GetRandomTarget()
{
if (targets.Count == 0)
return null;
return targets[Random.Range(0, targets.Count)];
}
public GameObject GetTargetAt(int index)
{
if (targets.Count == 0)
return null;
return targets[index];
}
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
}