private static void CreateBasicWall(TilemapVisualizer tilemapVisualizer, HashSet <Vector2Int> basicWallPositions, HashSet <Vector2Int> floorPositions) { foreach (var position in basicWallPositions) { string neighboursBinaryType = ""; foreach (var direction in Direction2D.cardinalDirectionsList) { var neighbourPosition = position + direction; if (floorPositions.Contains(neighbourPosition)) { neighboursBinaryType += "1"; } else { neighboursBinaryType += "0"; } } tilemapVisualizer.PaintSingleBasicWall(position, neighboursBinaryType); } }
private static void CreateBasicWalls(TilemapVisualizer tilemapVisualizer, HashSet <Vector2Int> basicWallPositions, HashSet <Vector2Int> floorPositions) { foreach (var pos in basicWallPositions) { string neighboursBinaryType = ""; foreach (var direction in Direction2D.cardinalDirectionList) // check all diagnal direction around the wall { var neighnourPosition = pos + direction; if (floorPositions.Contains(neighnourPosition)) // save the neighbour positions in binary { neighboursBinaryType += "1"; } else { neighboursBinaryType += "0"; } } tilemapVisualizer.PaintSingleBasicWall(pos, neighboursBinaryType); } }