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

Detailed Description

structure made up of a collection of identical gameobjects
if the members of the collection are ISaveData that data will also be stored

https://citybuilder.softleitner.com/manual/structures

Inheritance diagram for CityBuilderCore.StructureCollection:
CityBuilderCore.KeyedBehaviour CityBuilderCore.IStructure CityBuilderCore.IKeyed CityBuilderCore.IKeyed

Classes

class  StructureCollectionData
 

Public Member Functions

IEnumerable< Vector2Int > GetChildPoints (IGridPositions positions)
 
IEnumerable< Vector2Int > GetPoints ()
 retrieves all the points the structure occupies
 
bool HasPoint (Vector2Int position)
 checks if the structure occupies a certain point
 
void Add (Vector2Int point)
 
void Add (IEnumerable< Vector2Int > points)
 adds points to a structure, for example a tree to a tree structure collection
this may not be possible for structures with fixed points like buildings
typically called in a structures Start method
 
void Remove (Vector2Int point)
 
void Remove (IEnumerable< Vector2Int > points)
 removes points from the structure, for some structures like buildings removing any point will remove the whole thing
typically called in a structures OnDestroy method
 
void Clear ()
 
string GetName ()
 retrieves the name of the structure for display in the UI
 
StructureCollectionData SaveData ()
 
void LoadData (StructureCollectionData data)
 

Public Attributes

string Name
 
bool IsDestructible = true
 
bool IsMovable = true
 
bool IsDecorator = false
 
bool IsWalkable = false
 
StructureLevelMask Level
 
GameObject Prefab
 
Vector2Int ObjectSize = Vector2Int.one
 
- Public Attributes inherited from CityBuilderCore.KeyedBehaviour
string Key
 

Properties

StructureReference StructureReference [get, set]
 reference to the structure that keeps working even if the structure is replaced
 
bool IsReplica [get, set]
 
Transform Root [get]
 
- Properties inherited from CityBuilderCore.IKeyed
- Properties inherited from CityBuilderCore.IStructure

Events

Action< PointsChanged< IStructure > > PointsChanged
 
- Events inherited from CityBuilderCore.IStructure
Action< PointsChanged< IStructure > > PointsChanged
 has to be fired when a structures points changed so the manager can readjust paths
only viable for structures that are stored in list form like underlying, collections and tiles
other structures have to be reregistered
 

Member Function Documentation

◆ Add()

void CityBuilderCore.StructureCollection.Add ( IEnumerable< Vector2Int > points)
inline

adds points to a structure, for example a tree to a tree structure collection
this may not be possible for structures with fixed points like buildings
typically called in a structures Start method

Parameters
pointsthe points that will be added to the structure

Implements CityBuilderCore.IStructure.

◆ GetName()

string CityBuilderCore.StructureCollection.GetName ( )

retrieves the name of the structure for display in the UI

Returns
name of the structure for UI

Implements CityBuilderCore.IStructure.

◆ GetPoints()

IEnumerable< Vector2Int > CityBuilderCore.StructureCollection.GetPoints ( )

retrieves all the points the structure occupies

Returns
the points the structure occupies

Implements CityBuilderCore.IStructure.

◆ HasPoint()

bool CityBuilderCore.StructureCollection.HasPoint ( Vector2Int point)

checks if the structure occupies a certain point

Parameters
pointa point on the map
Returns
true if the structure occupies that point

Implements CityBuilderCore.IStructure.

◆ Remove()

void CityBuilderCore.StructureCollection.Remove ( IEnumerable< Vector2Int > points)
inline

removes points from the structure, for some structures like buildings removing any point will remove the whole thing
typically called in a structures OnDestroy method

Parameters
pointsthe points to remove

Implements CityBuilderCore.IStructure.

Property Documentation

◆ StructureReference

StructureReference CityBuilderCore.StructureCollection.StructureReference
getset

reference to the structure that keeps working even if the structure is replaced

Implements CityBuilderCore.IStructure.