-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
AIWaypointNetwork.cs
57 lines (52 loc) · 2.28 KB
/
AIWaypointNetwork.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
57
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
public enum PathDisplayMode { None, Paths, Connections, ConnectionPaths}
public enum GizmoShape { None, Cube, Sphere, WireCube, WireSphere, Texture }
[ExecuteInEditMode]
public class AIWaypointNetwork : MonoBehaviour
{
[HideInInspector] public PathDisplayMode DisplayMode = PathDisplayMode.Connections;
[HideInInspector] public GizmoShape shapes;
[HideInInspector] public int UIStartPoint = 0;
[HideInInspector] public int UIEndPoint = 0;
[HideInInspector] public Texture2D gizmoTexture;
[HideInInspector] public float gizmoSize;
[HideInInspector] public Color waypointsConnectionPointColor = new Color();
[HideInInspector] public Color waypointsPathsColor = new Color();
[HideInInspector] public Color waypointsConnectionsColor = new Color();
[HideInInspector] public Color waypointsConnectionPathsColor = new Color();
[HideInInspector] public List<Transform> Waypoints = new List<Transform>();
private void OnDrawGizmos()
{
foreach (var t in Waypoints.Where(t => t != null))
{
Gizmos.color = waypointsConnectionPointColor;
switch (shapes)
{
case GizmoShape.Cube:
Gizmos.DrawCube(t.position, new Vector3(gizmoSize, gizmoSize, gizmoSize));
break;
case GizmoShape.Sphere:
Gizmos.DrawSphere(t.position, gizmoSize);
break;
case GizmoShape.Texture:
if (gizmoTexture != null)
Gizmos.DrawGUITexture(
new Rect(t.position.x, t.position.y, (float) gizmoSize,
(float) gizmoSize), gizmoTexture);
break;
case GizmoShape.WireCube:
Gizmos.DrawWireCube(t.position, new Vector3(gizmoSize, gizmoSize, gizmoSize));
break;
case GizmoShape.WireSphere:
Gizmos.DrawWireSphere(t.position, gizmoSize);
break;
case GizmoShape.None:
break;
}
}
}
}