GameObject NewDest() { wp temp = wpm.NextDest(destVal); destVal = temp.value; return(temp.waypoint); }
public wp NextDest(float curVal) { wp temp = new wp(); int finiteLoops = 0; badPoint: int rnd = Random.Range(0, waypoints.Count); if (waypoints[rnd] && waypoints[rnd].GetComponent <WaypointValue>().Val(zoneCenter) > curVal) { temp.waypoint = waypoints[rnd]; temp.value = waypoints[rnd].GetComponent <WaypointValue>().Val(zoneCenter); } else { if (finiteLoops > 20) { Debug.Log("Way Too Many Loops"); temp.waypoint = zoneCenterGO; temp.value = 100; } else { finiteLoops++; goto badPoint; } } return(temp); }