ClassicCityBuilderKit 1.8.8
|
tracks all the IStructures on the map
used to check and retrieve structures at any point on the map
Public Member Functions | |
IEnumerable< IStructure > | GetStructures (int mask) |
retrieves all the structures on the map that have any of the levels in the mask | |
IEnumerable< IStructure > | GetStructures (Vector2Int point, int mask=0, bool? isWalkable=null, bool? isUnderlying=null, bool? isDecorator=null) |
retrieves all the structures at a point on the map that fit some criteria | |
IStructure | GetStructure (string key) |
retrieves a structure by its unique key | |
int | Remove (IEnumerable< Vector2Int > points, int mask, bool decoratorsOnly, Action< IStructure > removing=null) |
removes points from any structure that occupies that point for some structures that will remove the entire thing(buildings) | |
void | RegisterStructure (IStructure structure, bool isUnderlying=false) |
adds a structure into the managers care, others will now be able to retrieve it from the manager structures on the map should always be registered with the manager, | |
void | DeregisterStructure (IStructure structure, bool isUnderlying=false) |
removes a previously registered structure from the manager | |
Public Member Functions inherited from CityBuilderCore.ISaveData | |
string | SaveData () |
serializes the objects state(usually to json) and returns it | |
void | LoadData (string json) |
deserializes the serialized json data and loads the data as its new state | |
Events | |
Action | Changed |
fired whenever the points occupied by structures change | |
void CityBuilderCore.IStructureManager.DeregisterStructure | ( | IStructure | structure, |
bool | isUnderlying = false ) |
removes a previously registered structure from the manager
structure | the structure that will be added to the manager |
isUnderlying | should be the same as when RegisterStructure(IStructure, bool) was called |
Implemented in CityBuilderCore.DefaultStructureManager.
IStructure CityBuilderCore.IStructureManager.GetStructure | ( | string | key | ) |
retrieves a structure by its unique key
key | key of the structure, often set in the inspector |
Implemented in CityBuilderCore.DefaultStructureManager.
IEnumerable< IStructure > CityBuilderCore.IStructureManager.GetStructures | ( | int | mask | ) |
retrieves all the structures on the map that have any of the levels in the mask
mask | the structure level to check, 0 for all |
Implemented in CityBuilderCore.DefaultStructureManager.
IEnumerable< IStructure > CityBuilderCore.IStructureManager.GetStructures | ( | Vector2Int | point, |
int | mask = 0, | ||
bool? | isWalkable = null, | ||
bool? | isUnderlying = null, | ||
bool? | isDecorator = null ) |
retrieves all the structures at a point on the map that fit some criteria
point | a point on the map |
mask | structure level to check, o for all |
isWalkable | if you only want to check for structures that are walkable or non walkable |
isUnderlying | whether to check for underlying structures |
isDecorator | if you only want to check for decorators or non decorators |
Implemented in CityBuilderCore.DefaultStructureManager.
void CityBuilderCore.IStructureManager.RegisterStructure | ( | IStructure | structure, |
bool | isUnderlying = false ) |
adds a structure into the managers care, others will now be able to retrieve it from the manager
structures on the map should always be registered with the manager,
structure | the structure that will be added to the manager |
isUnderlying | whether the structure shold be stored in a special collection instead of a point dictionary, recommended for structures with low number but many points like road networks |
Implemented in CityBuilderCore.DefaultStructureManager.
int CityBuilderCore.IStructureManager.Remove | ( | IEnumerable< Vector2Int > | points, |
int | mask, | ||
bool | decoratorsOnly, | ||
Action< IStructure > | removing = null ) |
removes points from any structure that occupies that point
for some structures that will remove the entire thing(buildings)
points | the points on the map from which to remove structures |
mask | structure levels to remove, 0 for all |
decoratorsOnly | whether to only remove decorators, for example when building on top of them |
removing | action invoked for any structure that will have points removed, can be used to create dust or place demolishing animations instead of the structure |
Implemented in CityBuilderCore.DefaultStructureManager.