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

Detailed Description

manager behaviour that takes care of buildings, walkers and their bars

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

Inheritance diagram for CityBuilderCore.DefaultBuildingManager:
CityBuilderCore.IBuildingManager CityBuilderCore.IWalkerManager CityBuilderCore.IBarManager

Classes

class  BuildingMetaData
 
class  BuildingsData
 

Public Member Functions

Add< T > (Vector3 position, Quaternion rotation, T prefab, Action< T > initializer=null)
 creates a new building
 
int Count (BuildingInfo info)
 
int Count (BuildingCategory category)
 
IEnumerable< IBuildingGetBuildings ()
 
IEnumerable< IBuildingGetBuildings (BuildingCategory category)
 
IEnumerable< IBuildingGetBuildings (BuildingInfo info)
 
void RegisterBuilding (IBuilding building)
 registers a building into the managers responsibility, called by building on initialization
 
void DeregisterBuilding (IBuilding building)
 deregisters a building from the managers responsibility, called by building on termination
 
Walker GetWalker (Guid id)
 retrieves a walker by its id, can be used to get walker references when loading
 
IEnumerable< WalkerGetWalkers ()
 all the walkers currently active
 
void RegisterWalker (Walker walker)
 registers a walker into the managers responsibility, called by walker on initialization
 
void DeregisterWalker (Walker walker)
 deregisters a walker from the managers responsibility, called by walker on finish
 
IEnumerable< IBuildingGetBuilding (Vector2Int position)
 returns a building at the point, can be any point in the building not just the origin
 
BuildingReference GetBuildingReference (Guid id)
 retrieve building by its id, may be used to get building references when loading
 
BuildingComponentReference< T > RegisterBuildingTrait< T > (T component)
 registers a trait with the manager so the trait can be easily retrieved from outside
 
void ReplaceBuildingTrait< T > (T component, T replacement)
 replace a trait in its reference or remove it if there is no replacement, called by the component on replacement
 
void DeregisterBuildingTrait< T > (T component)
 deregister a trait from the manager, called by the component on termination
 
IEnumerable< T > GetBuildingTraits< T > ()
 
void ActivateBar (ViewBuildingBarBase view)
 activates a building bar and creates building value bars on every building that has the value
 
void ActivateBar (ViewWalkerBarBase view)
 activates a walker bar and creates building value bars on every walker that has the value
 
void DeactivateBar (ViewBuildingBarBase view)
 deactivates a building bar and destroys all the bars that were created
 
void DeactivateBar (ViewWalkerBarBase view)
 deactivates a walker bar and destroys all the bars that were created
 
bool HasEvolutionDelay (bool direction)
 
float GetEvolutionDelay (bool direction)
 
string AddEvolutionAddon (IBuilding building, bool direction)
 
string AddSuspensionAddon (IBuilding building)
 
string SaveData ()
 
void LoadData (string json)
 

Public Attributes

BuildingAddon AddingAddon
 
BuildingAddon SuspensionAddon
 
float EvolutionDelay
 
BuildingAddon EvolutionDelayAddon
 
float DevolutionDelay
 
BuildingAddon DevolutionDelayAddon
 
Transform BarRoot
 

Protected Member Functions

virtual void Awake ()
 
virtual void Update ()
 

Events

Action< IBuildingAdded
 
Action< IBuildingRegistered
 
Action< IBuildingDeregistered
 
Action< WalkerWalkerRegistered
 
Action< WalkerWalkerDeregistered
 
- Events inherited from CityBuilderCore.IBuildingManager
Action< IBuildingAdded
 fired after a new building has been instantiated and initialized
 
Action< IBuildingRegistered
 fired when a new building is registered(happens during initializion)
 
Action< IBuildingDeregistered
 fired when a building gets deregistered(happens during termination)
 
- Events inherited from CityBuilderCore.IWalkerManager
Action< WalkerWalkerRegistered
 fired when a new walker is registered(happens during initializion)
 
Action< WalkerWalkerDeregistered
 fired when a walker gets deregistered(happens during finish)
 

Member Function Documentation

◆ ActivateBar() [1/2]

void CityBuilderCore.DefaultBuildingManager.ActivateBar ( ViewBuildingBarBase view)
inline

activates a building bar and creates building value bars on every building that has the value

Parameters
viewthe view that will be activated

Implements CityBuilderCore.IBarManager.

◆ ActivateBar() [2/2]

void CityBuilderCore.DefaultBuildingManager.ActivateBar ( ViewWalkerBarBase view)
inline

activates a walker bar and creates building value bars on every walker that has the value

Parameters
viewthe view that will be activated

Implements CityBuilderCore.IBarManager.

◆ Add< T >()

T CityBuilderCore.DefaultBuildingManager.Add< T > ( Vector3 position,
Quaternion rotation,
T prefab,
Action< T > initializer = null )
inline

creates a new building

Template Parameters
T
Parameters
origin
rotation
prefab
Returns

Implements CityBuilderCore.IBuildingManager.

Type Constraints
T :Building 

◆ AddEvolutionAddon()

string CityBuilderCore.DefaultBuildingManager.AddEvolutionAddon ( IBuilding building,
bool direction )
inline

◆ AddSuspensionAddon()

string CityBuilderCore.DefaultBuildingManager.AddSuspensionAddon ( IBuilding building)
inline

◆ Count() [1/2]

int CityBuilderCore.DefaultBuildingManager.Count ( BuildingCategory category)

◆ Count() [2/2]

int CityBuilderCore.DefaultBuildingManager.Count ( BuildingInfo info)

◆ DeactivateBar() [1/2]

void CityBuilderCore.DefaultBuildingManager.DeactivateBar ( ViewBuildingBarBase view)
inline

deactivates a building bar and destroys all the bars that were created

Parameters
viewthe view that will be deactivated

Implements CityBuilderCore.IBarManager.

◆ DeactivateBar() [2/2]

void CityBuilderCore.DefaultBuildingManager.DeactivateBar ( ViewWalkerBarBase view)
inline

deactivates a walker bar and destroys all the bars that were created

Parameters
viewthe view that will be deactivated

Implements CityBuilderCore.IBarManager.

◆ DeregisterBuilding()

void CityBuilderCore.DefaultBuildingManager.DeregisterBuilding ( IBuilding building)
inline

deregisters a building from the managers responsibility, called by building on termination

Parameters
building

Implements CityBuilderCore.IBuildingManager.

◆ DeregisterBuildingTrait< T >()

void CityBuilderCore.DefaultBuildingManager.DeregisterBuildingTrait< T > ( T component)
inline

deregister a trait from the manager, called by the component on termination

Template Parameters
T
Parameters
component

Implements CityBuilderCore.IBuildingManager.

Type Constraints
T :IBuildingTrait<T> 

◆ DeregisterWalker()

void CityBuilderCore.DefaultBuildingManager.DeregisterWalker ( Walker walker)
inline

deregisters a walker from the managers responsibility, called by walker on finish

Parameters
walker

Implements CityBuilderCore.IWalkerManager.

◆ GetBuilding()

IEnumerable< IBuilding > CityBuilderCore.DefaultBuildingManager.GetBuilding ( Vector2Int point)
inline

returns a building at the point, can be any point in the building not just the origin

Parameters
point
Returns

Implements CityBuilderCore.IBuildingManager.

◆ GetBuildingReference()

BuildingReference CityBuilderCore.DefaultBuildingManager.GetBuildingReference ( Guid id)

retrieve building by its id, may be used to get building references when loading

Parameters
id
Returns

Implements CityBuilderCore.IBuildingManager.

◆ GetBuildings() [1/3]

IEnumerable< IBuilding > CityBuilderCore.DefaultBuildingManager.GetBuildings ( )

◆ GetBuildings() [2/3]

IEnumerable< IBuilding > CityBuilderCore.DefaultBuildingManager.GetBuildings ( BuildingCategory category)

◆ GetBuildings() [3/3]

IEnumerable< IBuilding > CityBuilderCore.DefaultBuildingManager.GetBuildings ( BuildingInfo info)

◆ GetBuildingTraits< T >()

IEnumerable< T > CityBuilderCore.DefaultBuildingManager.GetBuildingTraits< T > ( )
inline

Implements CityBuilderCore.IBuildingManager.

Type Constraints
T :IBuildingTrait<T> 

◆ GetEvolutionDelay()

float CityBuilderCore.DefaultBuildingManager.GetEvolutionDelay ( bool direction)
inline

◆ GetWalker()

Walker CityBuilderCore.DefaultBuildingManager.GetWalker ( Guid id)

retrieves a walker by its id, can be used to get walker references when loading

Parameters
idunique identifier of the walker
Returns
the walker if any walker has the id

Implements CityBuilderCore.IWalkerManager.

◆ GetWalkers()

IEnumerable< Walker > CityBuilderCore.DefaultBuildingManager.GetWalkers ( )

all the walkers currently active

Returns
all active walkers in the game

Implements CityBuilderCore.IWalkerManager.

◆ HasEvolutionDelay()

bool CityBuilderCore.DefaultBuildingManager.HasEvolutionDelay ( bool direction)
inline

◆ LoadData()

void CityBuilderCore.DefaultBuildingManager.LoadData ( string json)
inline

◆ RegisterBuilding()

void CityBuilderCore.DefaultBuildingManager.RegisterBuilding ( IBuilding building)
inline

registers a building into the managers responsibility, called by building on initialization

Parameters
building

Implements CityBuilderCore.IBuildingManager.

◆ RegisterBuildingTrait< T >()

BuildingComponentReference< T > CityBuilderCore.DefaultBuildingManager.RegisterBuildingTrait< T > ( T component)
inline

registers a trait with the manager so the trait can be easily retrieved from outside

Template Parameters
T
Parameters
component
Returns

Implements CityBuilderCore.IBuildingManager.

Type Constraints
T :IBuildingTrait<T> 

◆ RegisterWalker()

void CityBuilderCore.DefaultBuildingManager.RegisterWalker ( Walker walker)
inline

registers a walker into the managers responsibility, called by walker on initialization

Parameters
walker

Implements CityBuilderCore.IWalkerManager.

◆ ReplaceBuildingTrait< T >()

void CityBuilderCore.DefaultBuildingManager.ReplaceBuildingTrait< T > ( T component,
T replacement )
inline

replace a trait in its reference or remove it if there is no replacement, called by the component on replacement

Template Parameters
T
Parameters
component
replacement

Implements CityBuilderCore.IBuildingManager.

Type Constraints
T :IBuildingTrait<T> 

◆ SaveData()

string CityBuilderCore.DefaultBuildingManager.SaveData ( )
inline