internal List<ChunkColumn> AllNeighborColumns(ChunkColumn chunkColumn) { Vector2[] deltas = new Vector2[] { new Vector2(-1,-1), new Vector2(0,-1), new Vector2(1,-1), new Vector2(-1,0), new Vector2(1,0), new Vector2(-1,1), new Vector2(0,1), new Vector2(1,1), }; List<ChunkColumn> neighbors = new List<ChunkColumn>(); foreach (Vector2 delta in deltas) { PositionChunk chunkPos = new PositionChunk(chunkColumn.Position.X + (int)delta.X, 0, chunkColumn.Position.Z + (int)delta.Y); if (ChunkColumns.ContainsKey(chunkPos.Key)) neighbors.Add(ChunkColumns[chunkPos.Key]); else neighbors.Add(null); } return neighbors; }
private ChunkColumn GetChunkColumn(PositionChunk chunkPos) { PositionChunk columnPos = new PositionChunk(chunkPos.X, 0, chunkPos.Z); ChunkColumn column; if (ChunkColumns.ContainsKey(columnPos.Key)) { column = ChunkColumns[columnPos.Key]; } else { column = new ChunkColumn(columnPos.X, columnPos.Z); ChunkColumns.Add(columnPos.Key, column); column.InitializeStage(); } column.Active = true; return column; }