public SHR_Waypoint GetNearestWaypoint(Vector3 pos) { SHR_Waypoint closest = null; float closeDist = 100000f; foreach (var wp in GetComponentsInChildren <SHR_Waypoint>()) { float dist = Vector3.Distance(pos, wp.transform.position); if (dist < closeDist) { closeDist = dist; closest = wp; } } return(closest); }
public WPConnection(SHR_Waypoint wp, Type type) { this.wp = wp; this.type = type; }