Loading...
Searching...
No Matches
CityBuilderCore.BuildingRotation Class Referenceabstract

Detailed Description

facade for an integer from 0 to 3 describing the 4 possible directions for a building
used for transforming points in and out of building rotation(keeps building origin the same while rotating size and visuals)

Inheritance diagram for CityBuilderCore.BuildingRotation:
CityBuilderCore.BuildingRotationHexagon CityBuilderCore.BuildingRotationRectangle

Public Member Functions

void TurnClockwise ()
 
void TurnCounterClockwise ()
 
Vector2Int RotateOrigin (Vector2Int origin, Vector2Int size)
 calculates the rotated corner of a building from the placement origin
so bottom left with rotation 2 returns top right corner
can be used to get get the transform position from the origin
 
Vector2Int UnrotateOrigin (Vector2Int point, Vector2Int size)
 inverse of RotateOrigin(Vector2Int, Vector2Int) calculates the bottom left origin from the transform corner
 
Vector2Int RotateBuildingPoint (Vector2Int origin, Vector2Int point, Vector2Int size)
 rotates a point relative to the building(access points for example)
used to transform points in the building(0|1, 1|1) into world points
 
Vector2Int RotateSize (Vector2Int size)
 calculates the rotated size on the grid starting from the origin
 
Quaternion GetRotation ()
 returns the world rotation for the building visual
 
Quaternion GetRotation (bool isXY)
 

Static Public Member Functions

static BuildingRotation Create ()
 
static BuildingRotation Create (int state)
 
static BuildingRotation Create (Quaternion rotation)
 

Properties

int State [get, protected set]
 

Member Function Documentation

◆ GetRotation()

Quaternion CityBuilderCore.BuildingRotation.GetRotation ( )
abstract

returns the world rotation for the building visual

Returns

◆ RotateBuildingPoint()

Vector2Int CityBuilderCore.BuildingRotation.RotateBuildingPoint ( Vector2Int origin,
Vector2Int point,
Vector2Int size )
abstract

rotates a point relative to the building(access points for example)
used to transform points in the building(0|1, 1|1) into world points

Parameters
originorigin of the building in world space
pointpoint inside the building space
sizesize of the building
Returns
rotated point in world space

◆ RotateOrigin()

Vector2Int CityBuilderCore.BuildingRotation.RotateOrigin ( Vector2Int origin,
Vector2Int size )
abstract

calculates the rotated corner of a building from the placement origin
so bottom left with rotation 2 returns top right corner
can be used to get get the transform position from the origin

Parameters
originorigin point
sizebuilding size
Returns

◆ RotateSize()

Vector2Int CityBuilderCore.BuildingRotation.RotateSize ( Vector2Int size)
abstract

calculates the rotated size on the grid starting from the origin

Parameters
size
Returns

◆ UnrotateOrigin()

Vector2Int CityBuilderCore.BuildingRotation.UnrotateOrigin ( Vector2Int point,
Vector2Int size )
abstract

inverse of RotateOrigin(Vector2Int, Vector2Int) calculates the bottom left origin from the transform corner

Parameters
point
size
Returns