HexMapLibrary
Static Public Member Functions | Static Public Attributes | List of all members
Wunderwunsch.HexMapLibrary.HexUtility Class Reference

Contains helper methods which you usually won't need to use directly, but which are used by the library More...

Static Public Member Functions

static Vector3 LerpCubeCoordinates (Vector3Int start, Vector3Int target, float nudgeXfromCenter, float t)
 returns a lerped non-integer cube coordinate between origin and target cube coordinate. More...
 
static Vector3Int RoundCubeCoordinate (Vector3 cubeFloatCoords)
 rounds a non-integer cube coordinate to the closest integer cube coordinate More...
 
static EdgeAlignment GetEdgeAlignment (Vector3Int edge)
 returns the angle of the edge. returns 0 if parallel y-axis, 120 if along x-axis and 240 if along z-axis. More...
 
static CornerType GetCornerType (Vector3Int corner)
 
static MapSizeData CalculateMapCenterAndExtents (IEnumerable< Vector3Int > tiles, float yOffset=0)
 
static List< Vector3Int > RemoveInvalidCoordinates (List< Vector3Int > inputCollection, Dictionary< Vector3Int, int > validCollection)
 Helper Method for GetValidCoordinates which just compares input Coordinates with the set of valid coordinates of the map and removes all invalid. More...
 

Static Public Attributes

static Dictionary< EdgeAlignment, int > anglebyEdgeAlignment
 
static Dictionary< EdgeDirection, int > anglebyEdgeDirection
 

Detailed Description

Contains helper methods which you usually won't need to use directly, but which are used by the library

Member Function Documentation

◆ LerpCubeCoordinates()

static Vector3 Wunderwunsch.HexMapLibrary.HexUtility.LerpCubeCoordinates ( Vector3Int  start,
Vector3Int  target,
float  nudgeXfromCenter,
float  t 
)
static

returns a lerped non-integer cube coordinate between origin and target cube coordinate.

Parameters
startstart value
targettarget value
nudgeXfromCenteroffset of start value in x-direction
tinterpolation value, uses Mathf.Lerp which clamps value betweeen 0 and 1
Returns

◆ RoundCubeCoordinate()

static Vector3Int Wunderwunsch.HexMapLibrary.HexUtility.RoundCubeCoordinate ( Vector3  cubeFloatCoords)
static

rounds a non-integer cube coordinate to the closest integer cube coordinate

◆ GetEdgeAlignment()

static EdgeAlignment Wunderwunsch.HexMapLibrary.HexUtility.GetEdgeAlignment ( Vector3Int  edge)
static

returns the angle of the edge. returns 0 if parallel y-axis, 120 if along x-axis and 240 if along z-axis.

◆ RemoveInvalidCoordinates()

static List<Vector3Int> Wunderwunsch.HexMapLibrary.HexUtility.RemoveInvalidCoordinates ( List< Vector3Int >  inputCollection,
Dictionary< Vector3Int, int >  validCollection 
)
static

Helper Method for GetValidCoordinates which just compares input Coordinates with the set of valid coordinates of the map and removes all invalid.

Member Data Documentation

◆ anglebyEdgeAlignment

Dictionary<EdgeAlignment, int> Wunderwunsch.HexMapLibrary.HexUtility.anglebyEdgeAlignment
static
Initial value:
=
new Dictionary<EdgeAlignment, int>()
{
{ EdgeAlignment.ParallelToCubeY, 0 },
{ EdgeAlignment.ParallelToCubeX, 120 },
{ EdgeAlignment.ParallelToCubeZ, 240 }
}

◆ anglebyEdgeDirection

Dictionary<EdgeDirection, int> Wunderwunsch.HexMapLibrary.HexUtility.anglebyEdgeDirection
static
Initial value:
=
new Dictionary<EdgeDirection, int>()
{
{ EdgeDirection.Top, 0 },
{ EdgeDirection.TopRight, 60 },
{ EdgeDirection.BottomRight, 120 },
{ EdgeDirection.Bottom, 180 },
{ EdgeDirection.BottomLeft, 240 },
{ EdgeDirection.TopLeft, 300 }
}