Table of Contents

Class PointyHexOp<TCell>

Namespace
Gamelogic.Grids
Assembly
Assembly-CSharp.dll

Documentation in Op.cs

public class PointyHexOp<TCell> : AbstractOp<ShapeStorageInfo<PointyHexPoint>>

Type Parameters

TCell
Inheritance
PointyHexOp<TCell>
Inherited Members
Extension Methods

Constructors

PointyHexOp()

public PointyHexOp()

PointyHexOp(ShapeStorageInfo<PointyHexPoint>, Func<ShapeStorageInfo<PointyHexPoint>, ShapeStorageInfo<PointyHexPoint>, ShapeStorageInfo<PointyHexPoint>>)

public PointyHexOp(ShapeStorageInfo<PointyHexPoint> leftShapeInfo, Func<ShapeStorageInfo<PointyHexPoint>, ShapeStorageInfo<PointyHexPoint>, ShapeStorageInfo<PointyHexPoint>> combineShapeInfo)

Parameters

leftShapeInfo ShapeStorageInfo<PointyHexPoint>
combineShapeInfo Func<ShapeStorageInfo<PointyHexPoint>, ShapeStorageInfo<PointyHexPoint>, ShapeStorageInfo<PointyHexPoint>>

Methods

BeginGroup()

Starts a compound shape operation.

Any shape that is defined in terms of other shape operations must use this method, and use Endgroup() to end the definition.
public static PointyHexShapeInfo<TCell> MyCustomShape(this PointyHexOp<TCell> op)
{
	return 
		BeginGroup()
			.Shape1()
			.Union()
			.Shape2()
		.EndGroup(op);
}
Since version 1.1
public PointyHexOp<TCell> BeginGroup()

Returns

PointyHexOp<TCell>

Default(int, int)

Creates the grid in a shape that spans the entire storage rectangle of the given width and height.

public PointyHexShapeInfo<TCell> Default(int width, int height)

Parameters

width int
height int

Returns

PointyHexShapeInfo<TCell>

Diamond(int)

Left corner is the origin.

(This definition changed in 1.7).

public PointyHexShapeInfo<TCell> Diamond(int side)

Parameters

side int

Returns

PointyHexShapeInfo<TCell>

DownTriangle(int)

Origin is top right corner.

(This definition changed in 1.7).

public PointyHexShapeInfo<TCell> DownTriangle(int side)

Parameters

side int

Returns

PointyHexShapeInfo<TCell>

FatRectangle(int, int)

The bottom-left corner is the origin.

public PointyHexShapeInfo<TCell> FatRectangle(int width, int height)

Parameters

width int
height int

Returns

PointyHexShapeInfo<TCell>

Hexagon(PointyHexPoint, int)

public PointyHexShapeInfo<TCell> Hexagon(PointyHexPoint centre, int side)

Parameters

centre PointyHexPoint
side int

Returns

PointyHexShapeInfo<TCell>

Hexagon(int)

The center is the origin.

public PointyHexShapeInfo<TCell> Hexagon(int side)

Parameters

side int

Returns

PointyHexShapeInfo<TCell>

Parallelogram(int, int)

The bottom left corner is the origin.

public PointyHexShapeInfo<TCell> Parallelogram(int width, int height)

Parameters

width int
height int

Returns

PointyHexShapeInfo<TCell>

Rectangle(int, int)

The bottom left corner is the origin.

public PointyHexShapeInfo<TCell> Rectangle(int width, int height)

Parameters

width int
height int

Returns

PointyHexShapeInfo<TCell>

Shape(int, int, Func<PointyHexPoint, bool>)

The same as Shape with all parameters, but with bottomLeft Point set to PointyHexPoint.Zero.

public PointyHexShapeInfo<TCell> Shape(int width, int height, Func<PointyHexPoint, bool> isInside)

Parameters

width int
height int
isInside Func<PointyHexPoint, bool>

Returns

PointyHexShapeInfo<TCell>

Shape(int, int, Func<PointyHexPoint, bool>, PointyHexPoint)

Use this function to create shapes to ensure they fit into memory.

The test function can test shapes anywhere in space.If you specify the bottom corner (in terms of the storage rectangle), the shape is automatically translated in memory to fit, assuming memory width and height is big enough.

Strategy for implementing new shapes: - First, determine the test function. - Next, draw a storage rectangle that contains the shape. - Determine the storgae rectangle width and height. - Finally, determine the grid-space coordinate of the left bottom corner of the storage rectangle.

Then define your function as follows:

public PointyHexShapeInfo<TCell> MyShape()
{
	Shape(stargeRectangleWidth, storageRectangleHeight, isInsideMyShape, storageRectangleBottomleft);
}
public PointyHexShapeInfo<TCell> Shape(int width, int height, Func<PointyHexPoint, bool> isInside, PointyHexPoint bottomLeftCorner)

Parameters

width int

The widh of the storage rectangle

height int

The height of the storage rectangle

isInside Func<PointyHexPoint, bool>

A function that returns true if a passed point lies inside the shape being defined

bottomLeftCorner PointyHexPoint

The grid-space coordinate of the bottom left corner of the storage rect.

Returns

PointyHexShapeInfo<TCell>

Single()

Makes a grid with a single cell that corresponds to the origin.

public PointyHexShapeInfo<TCell> Single()

Returns

PointyHexShapeInfo<TCell>

ThinRectangle(int, int)

The bottom-left corner is the origin.

public PointyHexShapeInfo<TCell> ThinRectangle(int width, int height)

Parameters

width int
height int

Returns

PointyHexShapeInfo<TCell>

UpTriangle(int)

Origin is bottom left corner.

public PointyHexShapeInfo<TCell> UpTriangle(int side)

Parameters

side int

Returns

PointyHexShapeInfo<TCell>