Table of Contents

Class DiamondOp<TCell>

Namespace
Gamelogic.Grids
Assembly
Assembly-CSharp.dll

Documentation in Op.cs

public class DiamondOp<TCell> : AbstractOp<ShapeStorageInfo<DiamondPoint>>

Type Parameters

TCell
Inheritance
DiamondOp<TCell>
Inherited Members
Extension Methods

Constructors

DiamondOp()

public DiamondOp()

DiamondOp(ShapeStorageInfo<DiamondPoint>, Func<ShapeStorageInfo<DiamondPoint>, ShapeStorageInfo<DiamondPoint>, ShapeStorageInfo<DiamondPoint>>)

public DiamondOp(ShapeStorageInfo<DiamondPoint> leftShapeInfo, Func<ShapeStorageInfo<DiamondPoint>, ShapeStorageInfo<DiamondPoint>, ShapeStorageInfo<DiamondPoint>> combineShapeInfo)

Parameters

leftShapeInfo ShapeStorageInfo<DiamondPoint>
combineShapeInfo Func<ShapeStorageInfo<DiamondPoint>, ShapeStorageInfo<DiamondPoint>, ShapeStorageInfo<DiamondPoint>>

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 DiamondShapeInfo<TCell> MyCustomShape(this DiamondOp<TCell> op)
{
	return 
		BeginGroup()
			.Shape1()
			.Union()
			.Shape2()
		.EndGroup(op);
}
Since version 1.1
public DiamondOp<TCell> BeginGroup()

Returns

DiamondOp<TCell>

Default(int, int)

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

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

Parameters

width int
height int

Returns

DiamondShapeInfo<TCell>

Diamond(int)

The bottom left corner is always the origin.

public DiamondShapeInfo<TCell> Diamond(int side)

Parameters

side int

Returns

DiamondShapeInfo<TCell>

FatRectangle(int, int)

A fat rectangle. The bottom left corner is always the origin.

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

Parameters

width int
height int

Returns

DiamondShapeInfo<TCell>

Parallelogram(int, int)

The bottom left corner is always the origin.

[Version(1, 7, 0)]
public DiamondShapeInfo<TCell> Parallelogram(int width, int height)

Parameters

width int
height int

Returns

DiamondShapeInfo<TCell>

Rectangle(int, int)

A ragged rectangle. The bottom left corner is always the origin.

[Version(1, 7, 0)]
public DiamondShapeInfo<TCell> Rectangle(int width, int height)

Parameters

width int
height int

Returns

DiamondShapeInfo<TCell>

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

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

public DiamondShapeInfo<TCell> Shape(int width, int height, Func<DiamondPoint, bool> isInside)

Parameters

width int
height int
isInside Func<DiamondPoint, bool>

Returns

DiamondShapeInfo<TCell>

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

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 DiamondShapeInfo<TCell> MyShape()
{
	Shape(stargeRectangleWidth, storageRectangleHeight, isInsideMyShape, storageRectangleBottomleft);
}
public DiamondShapeInfo<TCell> Shape(int width, int height, Func<DiamondPoint, bool> isInside, DiamondPoint bottomLeftCorner)

Parameters

width int

The widh of the storage rectangle

height int

The height of the storage rectangle

isInside Func<DiamondPoint, bool>

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

bottomLeftCorner DiamondPoint

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

Returns

DiamondShapeInfo<TCell>

Single()

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

public DiamondShapeInfo<TCell> Single()

Returns

DiamondShapeInfo<TCell>

ThinRectangle(int, int)

A thin rectangle. The bottom left corner is always the origin.

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

Parameters

width int
height int

Returns

DiamondShapeInfo<TCell>