protected List <Vector2> Create_New_Waypoint_Set(List <int> RoomIDsInOrder)//for circular routes. //NOTE: These rooms should all be connected. Call Dijkstra's Algorithm to organise the list first. { List <Vector2> Waypoints = new List <Vector2>(); Vector2 Next; for (int I = 0; I < RoomIDsInOrder.Count; I++) { Rectangle RoomArea = map.Rooms[RoomIDsInOrder[I]].Location; if (map.D.Next(0, 100) > 50) { Rectangle CentralArea = new Rectangle(RoomArea.X + (RoomArea.Width / 4), RoomArea.Y + (RoomArea.Height / 4), RoomArea.Width / 2, RoomArea.Height / 2); Next = RectMethod.ReturnRandomEmptyTile(CentralArea, map.Collision.CMap, map.D); if (Next != new Vector2(-1, -1)) { Waypoints.Add(Next); } else { Next = RectMethod.ReturnRandomEmptyTile(RoomArea, map.Collision.CMap, map.D); if (Next != new Vector2(-1, -1)) { Waypoints.Add(Next); } else { //skip it } } } else { Next = RectMethod.ReturnRandomEmptyTile(RoomArea, map.Collision.CMap, map.D); if (Next != new Vector2(-1, -1)) { Waypoints.Add(Next); } else { //skip } } } return(Waypoints); }