public Waypoint NextWaypoint() { if (wpIndex >= (waypoints.Count - 1)) { if (type == Type.ReverseOnEnd) { waypoints.Reverse(); wpIndex = 0; } else if (type == Type.Circular) { wpIndex = 0; } } else { wpIndex++; } return currentWaypoint = waypoints.ToArray().ElementAt(wpIndex); }
public void Reset() { wpIndex = 0; currentWaypoint = waypoints.ToArray().ElementAt(wpIndex); }