HexMapLibrary
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Wunderwunsch.HexMapLibrary.CornersPositionsProvider Class Reference

Public Member Functions

 CornersPositionsProvider (CoordinateWrapper coordinateWrapper, Dictionary< Vector3Int, int > CornerIndexByPosition)
 
List< Vector3Int > OfTile (Vector3Int tile)
 returns the 6 corners of the input tile More...
 
List< Vector3Int > OfEdge (Vector3Int edge)
 returns the 2 corners adjacent to the input edge More...
 
List< Vector3Int > AdjacentToCorner (Vector3Int corner)
 returns the 3 corners adjacent to the input corner which belong to the map More...
 
List< Vector3Int > WithinDistance (Vector3Int centerCorner, int maxDistance, bool includeSelf)
 returns all corners within distance of the input corner - optionally including that corner. More...
 
List< Vector3Int > AtExactDistance (Vector3Int centerCorner, int distance)
 returns all corners at the exact distance of the input corner. More...
 
List< Vector3Int > PathAlongGrid (Vector3Int originCorner, Vector3Int targetCorner, bool includeOrigin, float horizontalNudgeFromOriginCenter=NudgePositive)
 returns the shortest path of corners from the origin to the target corner - optionally including the origin More...
 
List< Vector3Int > TileBorders (IEnumerable< Vector3Int > tiles)
 returns all corners of the input tiles which are adjacent to 1 or 2 tiles not belonging to the input set. More...
 

Protected Member Functions

List< Vector3Int > GetValidCornerCoordinates (List< Vector3Int > rawPositions)
 Wraps the input corner positions (if the map is periodic) and removes all those which are still out of the map bounds after that More...
 

Protected Attributes

readonly CoordinateWrapper coordinateWrapper
 
readonly Dictionary< Vector3Int, int > CornerIndexByPosition
 

Member Function Documentation

◆ OfTile()

List<Vector3Int> Wunderwunsch.HexMapLibrary.CornersPositionsProvider.OfTile ( Vector3Int  tile)

returns the 6 corners of the input tile

Map_GetCorners_OfTile.png
yellow = input tile , blue = result

◆ OfEdge()

List<Vector3Int> Wunderwunsch.HexMapLibrary.CornersPositionsProvider.OfEdge ( Vector3Int  edge)

returns the 2 corners adjacent to the input edge

Map_GetCorners_AdjacentToEdge.png
green = input edge , blue = result

◆ AdjacentToCorner()

List<Vector3Int> Wunderwunsch.HexMapLibrary.CornersPositionsProvider.AdjacentToCorner ( Vector3Int  corner)

returns the 3 corners adjacent to the input corner which belong to the map

Map_GetCorners_AdjacentToCorner_Combined.png
green = input corner , blue = result

◆ WithinDistance()

List<Vector3Int> Wunderwunsch.HexMapLibrary.CornersPositionsProvider.WithinDistance ( Vector3Int  centerCorner,
int  maxDistance,
bool  includeSelf 
)

returns all corners within distance of the input corner - optionally including that corner.

Map_GetCorners_WithinDistance.png
green = input corner , blue = result

◆ AtExactDistance()

List<Vector3Int> Wunderwunsch.HexMapLibrary.CornersPositionsProvider.AtExactDistance ( Vector3Int  centerCorner,
int  distance 
)

returns all corners at the exact distance of the input corner.

Map_GetCorners_AtExactDistance.png
green = input corner , blue = result

◆ PathAlongGrid()

List<Vector3Int> Wunderwunsch.HexMapLibrary.CornersPositionsProvider.PathAlongGrid ( Vector3Int  originCorner,
Vector3Int  targetCorner,
bool  includeOrigin,
float  horizontalNudgeFromOriginCenter = NudgePositive 
)

returns the shortest path of corners from the origin to the target corner - optionally including the origin

Map_GetCorners_PathAlongGrid.png
green = origin , purple = target, blue/purple = result - origin can optionally be included

◆ TileBorders()

List<Vector3Int> Wunderwunsch.HexMapLibrary.CornersPositionsProvider.TileBorders ( IEnumerable< Vector3Int >  tiles)

returns all corners of the input tiles which are adjacent to 1 or 2 tiles not belonging to the input set.

Map_GetCorners_TileBorders.png
green = input tiles , blue = result

◆ GetValidCornerCoordinates()

List<Vector3Int> Wunderwunsch.HexMapLibrary.CornersPositionsProvider.GetValidCornerCoordinates ( List< Vector3Int >  rawPositions)
protected

Wraps the input corner positions (if the map is periodic) and removes all those which are still out of the map bounds after that