public void SetWaypointManager(WaypointPathManager aControl) { MyWayControl = aControl; // grab total waypoints _totalWaypoints = MyWayControl.GetTotal(); // make sure that if you use SetReversePath to set shouldReversePathFollowing that you // call SetReversePath for the first time BEFORE SetWayController, otherwise it won't set the first waypoint correctly if (ShouldReversePathFollowing) { CurrentWaypointNum = _totalWaypoints - 1; } else { CurrentWaypointNum = 0; } Init(); // get the first waypoint from the waypoint controller CurrentWaypointTransform = MyWayControl.GetWaypoint(CurrentWaypointNum); if (StartAtFirstWaypoint) { // position at the currentWaypointTransform position MyTransform.position = CurrentWaypointTransform.position; } }
public void SetWaypointManager(WaypointPathManager aControl) { myWayControl = aControl; aControl = null; // grab total waypoints totalWaypoints = myWayControl.GetTotal(); // make sure that if you use SetReversePath to set shouldReversePathFollowing that you // call SetReversePath for the first time BEFORE SetWayController, otherwise it won't set the first waypoint correctly if (shouldReversePathFollowing) { currentWaypointNum = totalWaypoints - 1; } else { currentWaypointNum = 0; } Init(); // get the first waypoint from the waypoint controller currentWaypointTransform = myWayControl.GetWaypoint(currentWaypointNum); if (startAtFirstWaypoint) { // position at the currentWaypointTransform position myTransform.position = currentWaypointTransform.position; } }