Advertisement
Guest User

Untitled

a guest
Jul 7th, 2016
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 0.54 KB | None | 0 0
  1.   void _connectRegions() {
  2.     // Find all of the tiles that can connect two (or more) regions.
  3.     var connectorRegions = <Vec, Set<int>>{};
  4.     for (var pos in bounds.inflate(-1)) {
  5.       // Can't already be part of a region.
  6.       if (getTile(pos) != Tiles.wall) continue;
  7.  
  8.       var regions = new Set<int>();
  9.       for (var dir in Direction.CARDINAL) {
  10.         var region = _regions[pos + dir];
  11.         if (region != null) regions.add(region);
  12.       }
  13.  
  14.       if (regions.length < 2) continue;
  15.  
  16.       connectorRegions[pos] = regions;
  17.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement