Class PolarPointyBrickMap
This map can be used with a horizontally wrapped PointyHexGrid.
For now, alignment does not work as with the other maps.
[Version(1, 7, 0)]
public class PolarPointyBrickMap : AbstractMap<PointyHexPoint>, IPolarMap<PointyHexPoint>, IMap<PointyHexPoint>, IGridToWorldMap<PointyHexPoint>
- Inheritance
-
PolarPointyBrickMap
- Implements
- Inherited Members
- Extension Methods
Examples
Example:
IGrid%lt;PointyHexPoint> grid;
IMap3D map;
private void BuildGrid()
{
grid = PointyHexGrid<TCell>.HorizontallyWrappedParallelogram(width, height);
map = new PolarPointyBrickMap(Vector3.zero, 10, 110, newRectPoint(5, 10).To3DXY();
foreach (var point in grid)
{
var cell = Instantiate(cellPrefab);
cell.transform.localPosition = map[
}
}
public void Click(Vector3 worldPoint)
{
var gridPoint = map[worldPoint]
if (grid.Contains(gridPoint))
{
ClickCell(grid[gridPoint]);
}
}
Constructors
PolarPointyBrickMap(Vector2, float, float, VectorPoint)
public PolarPointyBrickMap(Vector2 center, float innerRadius, float outerRadius, VectorPoint sectorsAndBands)
Parameters
centerVector2innerRadiusfloatouterRadiusfloatsectorsAndBandsVectorPoint
Properties
Center
public Vector2 Center { get; }
Property Value
InnerRadius
public float InnerRadius { get; }
Property Value
OuterRadius
public float OuterRadius { get; }
Property Value
SectorAngle
public float SectorAngle { get; }
Property Value
SectorsAndBands
public VectorPoint SectorsAndBands { get; }
Property Value
Methods
CalcBottomLeft(IGridSpace<PointyHexPoint>)
public override Vector2 CalcBottomLeft(IGridSpace<PointyHexPoint> grid)
Parameters
gridIGridSpace<PointyHexPoint>
Returns
CalcGridDimensions(IGridSpace<PointyHexPoint>)
public override Vector2 CalcGridDimensions(IGridSpace<PointyHexPoint> grid)
Parameters
gridIGridSpace<PointyHexPoint>
Returns
GetEndAngleZ(PointyHexPoint)
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(PointyHexPoint gridPoint)
Parameters
gridPointPointyHexPoint
Returns
GetInnerRadius(PointyHexPoint)
Gets the inside radius of the band ath the given grid point.
public float GetInnerRadius(PointyHexPoint gridPoint)
Parameters
gridPointPointyHexPoint
Returns
GetOuterRadius(PointyHexPoint)
Gets the outside radius of the band ath the given grid point.
public float GetOuterRadius(PointyHexPoint gridPoint)
Parameters
gridPointPointyHexPoint
Returns
GetStartAngleZ(PointyHexPoint)
Returns the Z angle in degrees of the given grid point.
This can be used to rotate cells appropriately.
public float GetStartAngleZ(PointyHexPoint gridPoint)
Parameters
gridPointPointyHexPoint
Returns
GridToWorld(PointyHexPoint)
This method maps a grid point to a world point.
public override Vector2 GridToWorld(PointyHexPoint gridPoint)
Parameters
gridPointPointyHexPoint
Returns
InverseTransform(Vector2, float)
public static Vector2 InverseTransform(Vector2 v, float radius)
Parameters
Returns
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 PointyHexPoint RawWorldToGrid(Vector2 worldPoint)
Parameters
worldPointVector2
Returns
Transform(Vector2, float)
public static Vector2 Transform(Vector2 v, float radius)