Game Development Reference
In-Depth Information
public override void OnInspectorGUI ()
{
if ((targets != null) && (target != null)) {
seo_object.Update ();
sep_showGizmo.boolValue = EditorGUILayout.Toggle
("Show Gizmos", sep_showGizmo.boolValue);
if (sep_showGizmo.boolValue) {
sep_random.boolValue = EditorGUILayout.Toggle
("Random Path", sep_random.boolValue);
}
EditorGUILayout.Slider(sep_radius, 1.0f, 3.0f,
"Way Point Radius");
GUILayout.Label ("Waypoints",
EditorStyles.boldLabel);
Waypoint[] waypoints = GetWaypointArray ();
sep_waypointCount.intValue = waypoints.Length;
for (int i = 0; i < waypoints.Length; i++) {
GUILayout.BeginHorizontal ();
Waypoint result = EditorGUILayout.ObjectField
(waypoints[i], typeof(Waypoint), true) as Waypoint;
if (GUI.changed) {
SetWaypoint (i, result);
}
if (GUILayout.Button ("-")) {
RemoveWaypointAtIndex (i);
}
GUILayout.EndHorizontal ();
}
if (GUILayout.Button("Add Waypoint")) {
string indexString = (waypoints.Length < 9) ?
"0"+(waypoints.Length+1).ToString() :
(waypoints.Length+1).ToString();
GameObject go = new
GameObject(OBJECT_NAME+indexString);
go.transform.parent =
_wayPointsContainer.transform;
go.transform.localPosition = Vector3.zero;
Waypoint waypoint = go.AddComponent<Waypoint>();
Search WWH ::




Custom Search