public void CellsInRange(ref HexCell center, int range, List <HexCell> neighbours) { //Return tiles rnage steps from center, http://www.redblobgames.com/grids/hexagons/#range for (int dx = -range; dx <= range; dx++) { for (int dy = Mathf.Max(-range, -dx - range); dy <= Mathf.Min(range, -dx + range); dy++) { var o = new HexCubeCoordinate(dx, dy, -dx - dy) + center.coordinates; if (grid.TryGetValue(o.ToString(), out var cell)) { neighbours.Add(cell); } } } }
public void CellAt(ref HexCubeCoordinate coordinate, out HexCell cell) { grid.TryGetValue(coordinate.ToString(), out cell); }