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

Detailed Description

a building component that uses employees

Inheritance diagram for CityBuilderCore.IEmployment:
CityBuilderCore.IBuildingComponent CityBuilderCore.ISaveData CityBuilderCore.EmploymentComponent CityBuilderCore.EmploymentWalkerComponent

Public Member Functions

IEnumerable< EmploymentGroupGetEmploymentGroups ()
 returns which employment groups the employer needs
 
IEnumerable< PopulationGetPopulations ()
 returns which populations this component uses
 
int GetNeeded (EmploymentGroup employmentGroup, Population population)
 check how many workers of a population the component needs for a certain employment group
 
int AssignAvailable (EmploymentGroup employmentGroup, Population population, int quantity)
 assigns the quantity needed and returns the rest
 
- Public Member Functions inherited from CityBuilderCore.IBuildingComponent
void SetupComponent ()
 only called when the building is originally placed, before Initialize
 
void InitializeComponent ()
 initialization is performed when the building is placed or loaded
use to create references, register traits, ...
 
void TerminateComponent ()
 termination is performed when the building is destroyed
use to deregister traits, remove references from other systems
 
void OnReplacing (IBuilding replacement)
 called when a component gets replaced
use to transfer resources, replace references
 
void OnMoving ()
 called when the building is about to be moved
can be used to remove/deregister stuff from the old position
 
void OnMoved (Vector2Int oldPoint, BuildingRotation oldRotation)
 called after a building has been moved
can be used to register things at the new position
 
void SuspendComponent ()
 temporarily stops the component from working
 
void ResumeComponent ()
 resumes work in the component after SuspendComponent has been called
 
string GetDebugText ()
 text displayed in scene editor
 
string GetDescription ()
 text that may be displayed in dialogs
 
- 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
 

Properties

bool IsFullyStaffed [get]
 all needed employees are assigned
 
float EmploymentRate [get]
 the rate of employees assigned from 0 to 1
 
- Properties inherited from CityBuilderCore.IBuildingComponent
string Key [get]
 unique key used to identify the component in save/load
 
IBuilding Building [get, set]
 the building the component is attached to
is set by the building in awake
 

Member Function Documentation

◆ AssignAvailable()

int CityBuilderCore.IEmployment.AssignAvailable ( EmploymentGroup employmentGroup,
Population population,
int quantity )

assigns the quantity needed and returns the rest

Parameters
employmentGroup
population
quantity
Returns
workers count remaining

Implemented in CityBuilderCore.EmploymentComponent, and CityBuilderCore.EmploymentWalkerComponent.

◆ GetEmploymentGroups()

IEnumerable< EmploymentGroup > CityBuilderCore.IEmployment.GetEmploymentGroups ( )

returns which employment groups the employer needs

Returns
the employment groups used by this component

Implemented in CityBuilderCore.EmploymentComponent.

◆ GetNeeded()

int CityBuilderCore.IEmployment.GetNeeded ( EmploymentGroup employmentGroup,
Population population )

check how many workers of a population the component needs for a certain employment group

Parameters
employmentGroupthe group to check
populationthe relevant population
Returns
how many workers are needed in total

Implemented in CityBuilderCore.EmploymentComponent.

◆ GetPopulations()

IEnumerable< Population > CityBuilderCore.IEmployment.GetPopulations ( )

returns which populations this component uses

Returns
the populations this component uses

Implemented in CityBuilderCore.EmploymentComponent.

Property Documentation

◆ EmploymentRate

float CityBuilderCore.IEmployment.EmploymentRate
get

the rate of employees assigned from 0 to 1

Implemented in CityBuilderCore.EmploymentComponent.

◆ IsFullyStaffed

bool CityBuilderCore.IEmployment.IsFullyStaffed
get

all needed employees are assigned

Implemented in CityBuilderCore.EmploymentComponent.