Table of Contents

Class RectOp<TCell>

Namespace
Gamelogic.Grids
Assembly
Assembly-CSharp.dll

Documentation in Op.cs

public class RectOp<TCell> : AbstractOp<ShapeStorageInfo<RectPoint>>

Type Parameters

TCell
Inheritance
RectOp<TCell>
Inherited Members
Extension Methods

Constructors

RectOp()

public RectOp()

RectOp(ShapeStorageInfo<RectPoint>, Func<ShapeStorageInfo<RectPoint>, ShapeStorageInfo<RectPoint>, ShapeStorageInfo<RectPoint>>)

public RectOp(ShapeStorageInfo<RectPoint> leftShapeInfo, Func<ShapeStorageInfo<RectPoint>, ShapeStorageInfo<RectPoint>, ShapeStorageInfo<RectPoint>> combineShapeInfo)

Parameters

leftShapeInfo ShapeStorageInfo<RectPoint>
combineShapeInfo Func<ShapeStorageInfo<RectPoint>, ShapeStorageInfo<RectPoint>, ShapeStorageInfo<RectPoint>>

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

Returns

RectOp<TCell>

CheckerBoard(int, int)

public RectShapeInfo<TCell> CheckerBoard(int width, int height)

Parameters

width int
height int

Returns

RectShapeInfo<TCell>

CheckerBoard(int, int, bool)

public RectShapeInfo<TCell> CheckerBoard(int width, int height, bool includesOrigin)

Parameters

width int
height int
includesOrigin bool

Returns

RectShapeInfo<TCell>

Circle(int)

A rectangle centered at the given center, and with the given side length.

[Version(1, 9, 0)]
public RectShapeInfo<TCell> Circle(int radius)

Parameters

radius int

Returns

RectShapeInfo<TCell>

Default(int, int)

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

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

Parameters

width int
height int

Returns

RectShapeInfo<TCell>

FixedHeight(int, int)

public RectShapeInfo<TCell> FixedHeight(int height, int cellCount)

Parameters

height int
cellCount int

Returns

RectShapeInfo<TCell>

FixedWidth(int, int)

XXXXX XXXXX XXX

public RectShapeInfo<TCell> FixedWidth(int width, int cellCount)

Parameters

width int
cellCount int

Returns

RectShapeInfo<TCell>

IsInsideCheckerBoard(RectPoint, int, int, bool)

public static bool IsInsideCheckerBoard(RectPoint point, int width, int height, bool includesOrigin)

Parameters

point RectPoint
width int
height int
includesOrigin bool

Returns

bool

IsInsideFixedHeight(RectPoint, int, int)

public static bool IsInsideFixedHeight(RectPoint point, int height, int cellCount)

Parameters

point RectPoint
height int
cellCount int

Returns

bool

IsInsideFixedWidth(RectPoint, int, int)

public static bool IsInsideFixedWidth(RectPoint point, int width, int cellCount)

Parameters

point RectPoint
width int
cellCount int

Returns

bool

IsInsideRect(RectPoint, int, int)

public static bool IsInsideRect(RectPoint point, int width, int height)

Parameters

point RectPoint
width int
height int

Returns

bool

Parallelogram(int, int)

A synonym for Rectangle. Provided to support wrapped grids uniformly.

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

Parameters

width int
height int

Returns

RectShapeInfo<TCell>

Rectangle(int, int)

Generates a grid in a rectangular shape.

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

Parameters

width int

The width of the grid.

height int

The height of the grid.

Returns

RectShapeInfo<TCell>

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

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

public RectShapeInfo<TCell> Shape(int width, int height, Func<RectPoint, bool> isInside)

Parameters

width int
height int
isInside Func<RectPoint, bool>

Returns

RectShapeInfo<TCell>

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

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

Parameters

width int

The widh of the storage rectangle

height int

The height of the storage rectangle

isInside Func<RectPoint, bool>

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

bottomLeftCorner RectPoint

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

Returns

RectShapeInfo<TCell>

Single()

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

public RectShapeInfo<TCell> Single()

Returns

RectShapeInfo<TCell>