Example #1
0
        void FloodFillUtil(DungeonCell[,] _map, int x, int y, DungeonCellFillType prevC, DungeonCellFillType newC)
        {
            if (x < 0 || x >= _map.GetLength(0) || y < 0 || y >= _map.GetLength(1))
            {
                return;
            }

            var currentNode = _map[x, y];

            if (currentNode.fillType != prevC || currentNode.cellType == DungeonCellType.WALL)
            {
                return;
            }

            currentNode.SetFillType(newC);
            fillSpace++;
            FloodFillUtil(_map, x + 1, y, prevC, newC);
            FloodFillUtil(_map, x - 1, y, prevC, newC);
            FloodFillUtil(_map, x, y + 1, prevC, newC);
            FloodFillUtil(_map, x, y - 1, prevC, newC);
        }
Example #2
0
 public void SetFillType(DungeonCellFillType type)
 {
     _fillType = type;
 }
Example #3
0
 public DungeonCell(DungeonCellType type)
 {
     _cellType = type;
     _fillType = DungeonCellFillType.NON;
 }
Example #4
0
        void FloodFill(DungeonCell[,] _map, int x, int y, DungeonCellFillType newC)
        {
            var prevC = _map[x, y].fillType;

            FloodFillUtil(_map, x, y, prevC, newC);
        }