public LocationEntranceGenerator(Random random, LocationShape locationShape) { this.random = random; List <BorderTile> allBorderTiles = GetBorderTilesNeighboursArray(locationShape); List <BorderTile> possibleEntrance = SelectPosibleEntranceTiles(allBorderTiles); EntranceTiles = RandomEntrance(possibleEntrance); BorderTiles = allBorderTiles.Where(x => !EntranceTiles.Contains(x)).ToList(); IsFenceGenerated = EntranceTiles.Any(); }
private List <BorderTile> GetBorderTilesNeighboursArray(LocationShape locationShape) { List <BorderTile> borderTilesNeighboursArray = new List <BorderTile>(); foreach (Vector2Int borderTilePos in locationShape.BorderTilesPositions) { borderTilesNeighboursArray.Add(new BorderTile { Position = borderTilePos, NeighboursArray = locationShape.GetBlockNeighbours(borderTilePos) }); } return(borderTilesNeighboursArray); }