Loading...
Searching...
No Matches
CityBuilderCore.BuildingRotationRectangle Class Reference

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.BuildingRotationRectangle:
CityBuilderCore.BuildingRotation

Public Member Functions

 BuildingRotationRectangle (int state)
 
 BuildingRotationRectangle (Quaternion rotation)
 
override void TurnClockwise ()
 
override void TurnCounterClockwise ()
 
override 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
 
override Vector2Int UnrotateOrigin (Vector2Int point, Vector2Int size)
 inverse of RotateOrigin(Vector2Int, Vector2Int) calculates the bottom left origin from the transform corner
 
override Vector2Int RotateBuildingPoint (Vector2Int origin, Vector2Int point, Vector2Int size)
 rotates a point relative to the building(access points for example)
 
override Vector2Int RotateSize (Vector2Int size)
 calculates the rotated size on the grid starting from the origin
 
override Quaternion GetRotation ()
 returns the world rotation for the building visual
 
override Quaternion GetRotation (bool isXY)
 
- Public Member Functions inherited from CityBuilderCore.BuildingRotation
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)
 

Additional Inherited Members

- Static Public Member Functions inherited from CityBuilderCore.BuildingRotation
static BuildingRotation Create ()
 
static BuildingRotation Create (int state)
 
static BuildingRotation Create (Quaternion rotation)
 
- Properties inherited from CityBuilderCore.BuildingRotation
int State [get, protected set]
 

Member Function Documentation

◆ GetRotation()

override Quaternion CityBuilderCore.BuildingRotationRectangle.GetRotation ( )

returns the world rotation for the building visual

Returns

◆ RotateBuildingPoint()

override Vector2Int CityBuilderCore.BuildingRotationRectangle.RotateBuildingPoint ( Vector2Int origin,
Vector2Int point,
Vector2Int size )
inline

rotates a point relative to the building(access points for example)

Parameters
origin
point
size
Returns

◆ RotateOrigin()

override Vector2Int CityBuilderCore.BuildingRotationRectangle.RotateOrigin ( Vector2Int origin,
Vector2Int size )
inline

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()

override Vector2Int CityBuilderCore.BuildingRotationRectangle.RotateSize ( Vector2Int size)
inline

calculates the rotated size on the grid starting from the origin

Parameters
size
Returns

◆ UnrotateOrigin()

override Vector2Int CityBuilderCore.BuildingRotationRectangle.UnrotateOrigin ( Vector2Int point,
Vector2Int size )
inline

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

Parameters
point
size
Returns