void ReachDestination() { if (path.loop) { if (onDestinationE != null) { onDestinationE(this); } subWaypointID = 0; waypointID = path.GetLoopPoint(); subPath = path.GetWPSectionPath(waypointID); return; } dead = true; if (onDestinationE != null) { onDestinationE(this); } float delay = 0; StartCoroutine(_ReachDestination(delay)); }
//flag passed indicate initial reset, only true in the first call void Reset(bool initial = false) { //if use path-looping, use loop point otherwise use the starting point if (path.loop && !initial) { waypointID = path.GetLoopPoint(); } else { waypointID = 1; } subWaypointID = 0; subPath = path.GetWPSectionPath(waypointID); //only reset position if not using path-looping or it's the initial reset if (!path.loop || initial) { indicatorT.position = path.GetSpawnPoint().position; } }