Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void _connectRegions() {
- // Find all of the tiles that can connect two (or more) regions.
- var connectorRegions = <Vec, Set<int>>{};
- for (var pos in bounds.inflate(-1)) {
- // Can't already be part of a region.
- if (getTile(pos) != Tiles.wall) continue;
- var regions = new Set<int>();
- for (var dir in Direction.CARDINAL) {
- var region = _regions[pos + dir];
- if (region != null) regions.add(region);
- }
- if (regions.length < 2) continue;
- connectorRegions[pos] = regions;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement