public CCaveRoom(List <Vector2Int> roomTiles, CCellularGrid map) { tiles = roomTiles; roomSize = tiles.Count; connectedRooms = new List <CCaveRoom>(); edgeTiles = new List <Vector2Int>(); foreach (Vector2Int tile in tiles) { for (int x = tile.x - 1; x <= tile.x + 1; x++) { for (int z = tile.y - 1; z <= tile.y + 1; z++) { bool b = map.InMapRange(x, z); if (!b) { continue; } if (x == tile.x || z == tile.y) { if (map[x, z] == 1) { edgeTiles.Add(tile); } } } } } }
public void Generate(int numCols, int numRows) { m_map = new CCellularGrid(numCols, numRows); m_map.Generate(); ProcessRegion(); ConnectClosestRooms(m_survivingRooms); }
public override void Generate() { base.Generate(); m_terrain.Generate(m_numCols, m_numRows); CCellularGrid cellular = m_terrain.Map; for (int x = 0; x < m_numCols; x++) { for (int z = 0; z < m_numRows; z++) { bool walk = cellular[x, z] == 0; int type = GetTypeByAlive(walk); //var asset = m_assetList[type]; int asset = 0; m_grid.FillData(x, z, type, asset, walk); } } }