SpiralOutward(CubicHexCoord center, int range, DirectionEnum startDirection = DirectionEnum.E) { if (range <= 0) { throw new ArgumentOutOfRangeException("range must be a positive integer value."); } else if (range == 0) { return(new CubicHexCoord[1] { center }); } int arraySize = 1; for (int i = range; i > 0; i--) { arraySize += 6 * i; } CubicHexCoord[] result = new CubicHexCoord[arraySize]; result[0] = center; int arrayIndex = 1; for (int i = 1; i <= range; i++) { CubicHexCoord[] ring = CubicHexCoord.Ring(center, i, startDirection); ring.CopyTo(result, arrayIndex); arrayIndex += ring.Length; } return(result); }
RingAround(int range, DirectionEnum startDirection = DirectionEnum.E) { return(CubicHexCoord.Ring(this, range, startDirection)); }