public void generateRobots(Tier tier, Tile[,] tiles) { List <List <Waypoint> > waypoints = getWaypointsForInitialRobotPositions(tiles); List <Waypoint> potentialBotLocations = waypoints.SelectMany(w => w).Where(w => w.Pod == null && w.InputStation == null && w.OutputStation == null).ToList(); for (int i = 0; i < lc.BotCount; i++) { int randomWaypointIndex = rand.NextInt(potentialBotLocations.Count); Waypoint botWaypoint = potentialBotLocations[randomWaypointIndex]; int orientation = 0; Bot bot = instance.CreateBot(instance.RegisterBotID(), tier, botWaypoint.X, botWaypoint.Y, lc.BotRadius, orientation, lc.PodTransferTime, lc.MaxAcceleration, lc.MaxDeceleration, lc.MaxVelocity, lc.TurnSpeed, lc.CollisionPenaltyTime); botWaypoint.AddBotApproaching(bot); bot.CurrentWaypoint = botWaypoint; potentialBotLocations.RemoveAt(randomWaypointIndex); } }