private void AddNeighboursToSearchFrontier(ChunkCell cell) { foreach (var neighbour in cell.NonNullNeighbors) { if (_closed.Contains(neighbour)) { continue; } AddCellToFrontier(neighbour); } }
internal ChunkCell[,] GetCells(int offsetX, int offsetY) { var cells = new ChunkCell[MapGenerationData.Instance.ChunkSize, MapGenerationData.Instance.ChunkSize]; offsetX *= MapGenerationData.Instance.ChunkSize; offsetY *= MapGenerationData.Instance.ChunkSize; for (var x = 0; x < MapGenerationData.Instance.ChunkSize; x++) { for (var y = 0; y < MapGenerationData.Instance.ChunkSize; y++) { cells[x, y] = _cells[offsetX + x, offsetY + y]; } } return(cells); }
private ChunkCell[,] GetCells() { var cells = new ChunkCell[_size, _size]; var waterCol = ColorExtensions.GetColorFromHex("7f7e7d"); for (int x = 0; x < _size; x++) { for (int y = 0; y < _size; y++) { var height = _heightMap[x, y]; cells[x, y] = new ChunkCell(x, y, height, height > 0 ? GetBiome(_temperatureMap[x, y], _moistureMap[x, y]) : waterCol); } } Pathfinder.LinkCellsToNeighbors(cells, _size); return(cells); }
private void AddCellToFrontier(ChunkCell cell) { _searchFrontier.Enqueue(cell); _closed.Add(cell); }
public JoinedAreaSearcher(ChunkCell origin, CompareMethod compare, int maxIterations = 10000) { _search = compare; _origin = origin; _maxIterations = maxIterations; }