Loading...
Searching...
No Matches
CityBuilderCore.IMap Interface Reference

Detailed Description

basic map functionality like map size and buildability

Inheritance diagram for CityBuilderCore.IMap:
CityBuilderCore.MapBase CityBuilderCore.Tests.DebugMap CityBuilderCore.DefaultMap CityBuilderCore.HexagonMap CityBuilderCore.IsometricMap CityBuilderCore.TerrainMap

Public Member Functions

bool IsInside (Vector2Int point)
 checks if a point is inside the map size
 
bool IsWalkable (Vector2Int point)
 check if a point can be walked on and may be used in pathfinding
 
bool IsBuildable (Vector2Int point, int mask, object tag=null)
 checks if a point is ok to build on or if the map somehow blocks building there
 
bool CheckGround (Vector2Int point, Object[] options)
 checks the ground for certain features
for example in tilemap base maps this would be a tile
 
Vector3 ClampPosition (Vector3 position)
 clamps a position to be inside the maps size
if, for example, a position 5,-10 is passed for a map that starts at 0,0 the position will be clamped to 5,0
 
Vector2Int ClampPoint (Vector2Int point)
 clamps a point to be inside the maps size
 
Vector3 GetVariance ()
 get position variance for walkers and such, can be used so walkers on the same point dont overlap
 

Properties

bool IsXY [get]
 whether the map grid is in xy, usually in 2d games
3d games often use Y as the height axis and have their grid in XZ
 
bool IsHex [get]
 whether we're on a hexagonal map which may need some special handling
 
Vector2Int Size [get]
 map size in cell count
 
Vector3 CellOffset [get]
 delta position from one cell to the next
 
Vector3 WorldCenter [get]
 world position at the center of the map
 

Member Function Documentation

◆ CheckGround()

bool CityBuilderCore.IMap.CheckGround ( Vector2Int point,
Object[] options )

checks the ground for certain features
for example in tilemap base maps this would be a tile

Parameters
pointthe point on the map to check
optionsa set of features that would be acceptable
Returns
true if the ground exhibits one of the features

Implemented in CityBuilderCore.DefaultMap, CityBuilderCore.MapBase, and CityBuilderCore.Tests.DebugMap.

◆ ClampPoint()

Vector2Int CityBuilderCore.IMap.ClampPoint ( Vector2Int point)

clamps a point to be inside the maps size

Parameters
pointa point that may or may not be inside the map
Returns
a point inside the map

Implemented in CityBuilderCore.MapBase, and CityBuilderCore.Tests.DebugMap.

◆ ClampPosition()

Vector3 CityBuilderCore.IMap.ClampPosition ( Vector3 position)

clamps a position to be inside the maps size
if, for example, a position 5,-10 is passed for a map that starts at 0,0 the position will be clamped to 5,0

Parameters
positionthe position to check
Returns
the clamped position

Implemented in CityBuilderCore.HexagonMap, CityBuilderCore.IsometricMap, CityBuilderCore.MapBase, and CityBuilderCore.Tests.DebugMap.

◆ GetVariance()

Vector3 CityBuilderCore.IMap.GetVariance ( )

get position variance for walkers and such, can be used so walkers on the same point dont overlap

Returns

Implemented in CityBuilderCore.IsometricMap, CityBuilderCore.MapBase, and CityBuilderCore.Tests.DebugMap.

◆ IsBuildable()

bool CityBuilderCore.IMap.IsBuildable ( Vector2Int point,
int mask,
object tag = null )

checks if a point is ok to build on or if the map somehow blocks building there

Parameters
pointthe point on the map to check
maskthe structure levels to check, 0 for all
Returns

Implemented in CityBuilderCore.DefaultMap, CityBuilderCore.MapBase, CityBuilderCore.TerrainMap, and CityBuilderCore.Tests.DebugMap.

◆ IsInside()

bool CityBuilderCore.IMap.IsInside ( Vector2Int point)

checks if a point is inside the map size

Parameters
pointthe point to check
Returns
true if the point is inside the map

Implemented in CityBuilderCore.MapBase, and CityBuilderCore.Tests.DebugMap.

◆ IsWalkable()

bool CityBuilderCore.IMap.IsWalkable ( Vector2Int point)

check if a point can be walked on and may be used in pathfinding

Parameters
pointthe point to check
Returns
true if the point allows walkers to pass

Implemented in CityBuilderCore.DefaultMap, CityBuilderCore.MapBase, and CityBuilderCore.Tests.DebugMap.

Property Documentation

◆ CellOffset

Vector3 CityBuilderCore.IMap.CellOffset
get

delta position from one cell to the next

Implemented in CityBuilderCore.MapBase, and CityBuilderCore.Tests.DebugMap.

◆ IsHex

bool CityBuilderCore.IMap.IsHex
get

whether we're on a hexagonal map which may need some special handling

Implemented in CityBuilderCore.MapBase, and CityBuilderCore.Tests.DebugMap.

◆ IsXY

bool CityBuilderCore.IMap.IsXY
get

whether the map grid is in xy, usually in 2d games
3d games often use Y as the height axis and have their grid in XZ

Implemented in CityBuilderCore.MapBase, and CityBuilderCore.Tests.DebugMap.

◆ WorldCenter

Vector3 CityBuilderCore.IMap.WorldCenter
get