Table of Contents

Class PolarFlatBrickMap

Namespace
Gamelogic.Grids
Assembly
Assembly-CSharp.dll

This map can be used with a horizontally wrapped FlatHexGrid. For now, alignment does not work as with the other maps.

[Version(1, 7, 0)]
public class PolarFlatBrickMap : AbstractMap<FlatHexPoint>, IPolarMap<FlatHexPoint>, IMap<FlatHexPoint>, IGridToWorldMap<FlatHexPoint>
Inheritance
PolarFlatBrickMap
Implements
Inherited Members
Extension Methods

Examples

IGrid<FlatHexPoint> grid;
IMap3D map;

private void BuildGrid()
{
	grid = FlatHexGrid<TCell>.HorizontallyWrappedParallelogram(width, height);
	map = new PolarFlatBrickMap(Vector3.zero, 10, 110, newRectPoint(5, 10).To3DXY();

	foreach (var point in grid)
	{
		var cell = Instantiate(cellPrefab);
		cell.transform.localPosition = map[point];
	}
}

public void Click(Vector3 worldPoint)
{
	var gridPoint = map[worldPoint]

	if (grid.Contains(gridPoint))
	{
		ClickCell(grid[gridPoint]);
	}
}

Constructors

PolarFlatBrickMap(Vector2, float, float, VectorPoint)

public PolarFlatBrickMap(Vector2 center, float innerRadius, float outerRadius, VectorPoint sectorsAndBands)

Parameters

center Vector2
innerRadius float
outerRadius float
sectorsAndBands VectorPoint

Properties

Center

public Vector2 Center { get; }

Property Value

Vector2

InnerRadius

public float InnerRadius { get; }

Property Value

float

OuterRadius

public float OuterRadius { get; }

Property Value

float

SectorAngle

public float SectorAngle { get; }

Property Value

float

SectorsAndBands

public VectorPoint SectorsAndBands { get; }

Property Value

VectorPoint

Methods

GetEndAngleZ(FlatHexPoint)

Returns the Z angle in degrees of the given grid point at the end of the sector.

This is useful for making a mesh for the sector band, for instance.

public float GetEndAngleZ(FlatHexPoint gridPoint)

Parameters

gridPoint FlatHexPoint

Returns

float

GetInnerRadius(FlatHexPoint)

Gets the inside radius of the band ath the given grid point.

public float GetInnerRadius(FlatHexPoint gridPoint)

Parameters

gridPoint FlatHexPoint

Returns

float

GetOuterRadius(FlatHexPoint)

Gets the outside radius of the band ath the given grid point.

public float GetOuterRadius(FlatHexPoint gridPoint)

Parameters

gridPoint FlatHexPoint

Returns

float

GetStartAngleZ(FlatHexPoint)

Returns the Z angle in degrees of the given grid point at the start of the sector.

This is useful for making a mesh for the sector band, for instance.

public float GetStartAngleZ(FlatHexPoint gridPoint)

Parameters

gridPoint FlatHexPoint

Returns

float

GridToWorld(FlatHexPoint)

This method maps a grid point to a world point.

public override Vector2 GridToWorld(FlatHexPoint gridPoint)

Parameters

gridPoint FlatHexPoint

Returns

Vector2

RawWorldToGrid(Vector2)

This method maps a world point to a grid point, assuming that the anchor point is centered in the cell.This will allow the index accessors[] to give correct results for any anchoring.

public override FlatHexPoint RawWorldToGrid(Vector2 worldPoint)

Parameters

worldPoint Vector2

Returns

FlatHexPoint