Game Development Reference
In-Depth Information
"Way Point Radius");
GUILayout.Label ("Waypoints",
EditorStyles.boldLabel);
var waypoints : Waypoint[] = GetWaypointArray ();
sep_waypointCount.intValue = waypoints.Length;
for (var i : int = 0; i < waypoints.Length; i++) {
GUILayout.BeginHorizontal ();
var result : Waypoint =
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")) {
var indexString : String = (waypoints.Length <
9) ? "0"+(waypoints.Length+1).ToString() :
(waypoints.Length+1).ToString();
var go : GameObject = new
GameObject(OBJECT_NAME+indexString);
go.transform.parent =
_wayPointsContainer.transform;
go.transform.localPosition = Vector3.zero;
var waypoint : Waypoint =
go.AddComponent.<Waypoint>();
AddWayPoint (waypoint);
Undo.RegisterCreatedObjectUndo(go,"AddWaypointButton");
}
seo_object.ApplyModifiedProperties ();
}
}
// C# user:
Search WWH ::




Custom Search