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

Detailed Description

building component that produces items from other items

Inheritance diagram for CityBuilderCore.IProductionComponent:
CityBuilderCore.IProgressComponent CityBuilderCore.IItemReceiver CityBuilderCore.IItemOwner CityBuilderCore.IBuildingComponent CityBuilderCore.IBuildingTrait< IItemReceiver > CityBuilderCore.IItemOwner CityBuilderCore.ISaveData CityBuilderCore.ProductionComponent CityBuilderCore.VariantProductionComponent CityBuilderCore.ProductionWalkerComponent CityBuilderTown.TownProductionComponent CityBuilderCore.VariantProductionWalkerComponent

Public Member Functions

IEnumerable< ItemLevelGetNeededItems ()
 exposes the items the production component needs to work
 
IEnumerable< ItemLevelGetProducedItems ()
 exposes the items the component can produce
 
- 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
 
- Public Member Functions inherited from CityBuilderCore.IItemReceiver
IEnumerable< ItemGetReceiveItems ()
 returns the kinds of items the receiver needs
 
int GetReceiveCapacity (Item item)
 how much of the item the receiver can still fit
 
void ReserveCapacity (Item item, int quantity)
 reserves a capacity in the receiver so it is not filled up by someone else
 
void UnreserveCapacity (Item item, int quantity)
 releases capacity that was earlier reserved by ReserveCapacity(Item, int)
call before actually moving items into the receiver or if the delivery was somehow interrupted
 
int Receive (ItemStorage storage, Item item, int quantity)
 requests that a quantity of items is moved from the storage to the receiver
if the full amount does not fit the remaining quantity is returned
 

Additional Inherited Members

- Properties inherited from CityBuilderCore.IProgressComponent
float Progress [get]
 progress 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
 
- Properties inherited from CityBuilderCore.IItemReceiver
int Priority [get]
 can be used so certain receivers are preferred over others
for example construction sites or production may be more important that putting items into storage
 
- Properties inherited from CityBuilderCore.IBuildingTrait< IItemReceiver >
BuildingComponentReference< T > Reference [get, set]
 reference to the building trait, use when the building might be replaced and when the reference has to be saved
 
- Properties inherited from CityBuilderCore.IItemOwner
IItemContainer ItemContainer [get]
 holds and manages the items for the owner
 
- Events inherited from CityBuilderCore.IProgressComponent
Action ProgressReset
 progress has finished and is reset to 0
 
Action< float > ProgressChanged
 progress has changed, carries new progress
 

Member Function Documentation

◆ GetNeededItems()

IEnumerable< ItemLevel > CityBuilderCore.IProductionComponent.GetNeededItems ( )

exposes the items the production component needs to work

Returns

Implemented in CityBuilderCore.ProductionComponent, and CityBuilderCore.VariantProductionComponent.

◆ GetProducedItems()

IEnumerable< ItemLevel > CityBuilderCore.IProductionComponent.GetProducedItems ( )

exposes the items the component can produce

Returns

Implemented in CityBuilderCore.ProductionComponent, and CityBuilderCore.VariantProductionComponent.