private void InitializeAsEvenHex(ITerrainNode[,] nodesArray) { var rowsLength = nodesArray.GetLength(X_DIMENDION); var columnsLength = nodesArray.GetLength(Z_DIMENSION); var collection = new List<ITerrainNode>(); if (RowIndex + 1 < rowsLength && ColumnIndex + 1 < columnsLength) { collection.Add(nodesArray[RowIndex + 1, ColumnIndex + 1]); } if (RowIndex - 1 >= 0 && ColumnIndex + 1< columnsLength) { collection.Add(nodesArray[RowIndex - 1, ColumnIndex + 1]); } if (RowIndex - 2 >= 0) { collection.Add(nodesArray[RowIndex - 2, ColumnIndex]); } if (RowIndex - 1 >= 0) { collection.Add(nodesArray[RowIndex - 1, ColumnIndex]); } if (RowIndex + 1 < rowsLength) { collection.Add(nodesArray[RowIndex + 1, ColumnIndex]); } if (RowIndex + 2 < rowsLength) { collection.Add(nodesArray[RowIndex + 2, ColumnIndex]); } Nodes = collection; }
public TerrainNodeContainer(ITerrainNode[,] terrainNodesArray) { TerrainNodesArray = terrainNodesArray; RowsLength = terrainNodesArray.GetLength(X_DIMENDION); ColumnsLength = terrainNodesArray.GetLength(Z_DIMENSION); }