ClassicCityBuilderKit 1.8.8
|
base class for building components implementing IBuildingComponent
Public Member Functions | |
virtual void | SetupComponent () |
only called when the building is originally placed, before Initialize | |
virtual void | InitializeComponent () |
initialization is performed when the building is placed or loaded use to create references, register traits, ... | |
virtual void | OnReplacing (IBuilding replacement) |
called when a component gets replaced use to transfer resources, replace references | |
virtual void | TerminateComponent () |
termination is performed when the building is destroyed use to deregister traits, remove references from other systems | |
virtual void | OnMoving () |
called when the building is about to be moved can be used to remove/deregister stuff from the old position | |
virtual void | OnMoved (Vector2Int oldPoint, BuildingRotation oldRotation) |
called after a building has been moved can be used to register things at the new position | |
virtual void | SuspendComponent () |
temporarily stops the component from working | |
virtual void | ResumeComponent () |
resumes work in the component after SuspendComponent has been called | |
virtual string | GetDebugText () |
returns text that gets displayed for debugging in the scene editor | |
virtual string | GetDescription () |
gets displayed in dialogs to show the component status to players | |
virtual string | SaveData () |
serializes the objects state(usually to json) and returns it | |
virtual void | LoadData (string json) |
deserializes the serialized json data and loads the data as its new state | |
Protected Member Functions | |
T | getOther< T > () |
gets the first building component of the specified type on the same building | |
IEnumerable< T > | getOthers< T > () |
gets all building components of the specified type on the same building | |
BuildingComponentReference< T > | registerTrait< T > (T trait) |
registers the building component as a trait so it is globally accessible usually done in InitializeComponent | |
void | replaceTrait< T > (T trait, T replacement) |
replaces the reference a trait points to in the global manager done when a building is replaced(OnReplacing(IBuilding)) so the trait now points to the new component instead of the one that has been removed | |
void | deregisterTrait< T > (T trait) |
removes a previously registered trait usually when a building is removed which calls TerminateComponent | |
Properties | |
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.IBuildingComponent |
|
inlineprotected |
removes a previously registered trait
usually when a building is removed which calls TerminateComponent
T |
trait |
T | : | IBuildingTrait<T> |
|
virtual |
returns text that gets displayed for debugging in the scene editor
Implements CityBuilderCore.IBuildingComponent.
Reimplemented in CityBuilderCore.AttackableComponent, CityBuilderCore.CollectionComponent, CityBuilderCore.DistributionComponent, CityBuilderCore.EmploymentComponent, CityBuilderCore.ItemsRetrieverComponent, CityBuilderCore.ProgressComponent, CityBuilderCore.StorageComponent, CityBuilderCore.VariantProductionComponent, CityBuilderTown.TownHomeComponent, and CityBuilderTown.TownMarketComponent.
|
virtual |
gets displayed in dialogs to show the component status to players
Implements CityBuilderCore.IBuildingComponent.
Reimplemented in CityBuilderCore.EmploymentComponent, CityBuilderCore.EvolutionComponent, and CityBuilderCore.HousingComponent.
|
protected |
gets the first building component of the specified type on the same building
T | type of the building component to return |
T | : | class | |
T | : | IBuildingComponent |
|
protected |
gets all building components of the specified type on the same building
T | type of the building components to return |
T | : | class | |
T | : | IBuildingComponent |
|
inlinevirtual |
initialization is performed when the building is placed or loaded
use to create references, register traits, ...
Implements CityBuilderCore.IBuildingComponent.
Reimplemented in CityBuilderCore.AttackableComponent, CityBuilderCore.CollectionComponent, CityBuilderCore.ConnectionFeederComponent, CityBuilderCore.ConnectionPasserComponent, CityBuilderCore.EmploymentComponent, CityBuilderCore.HousingComponent, CityBuilderCore.HousingPlaceholderComponent, CityBuilderCore.ItemEfficiencyComponent, CityBuilderCore.MonumentSiteComponent, CityBuilderCore.ProductionComponent, CityBuilderCore.ProgressComponent, CityBuilderCore.RoadBlockerComponent, CityBuilderCore.SpriteRandomizerComponent, CityBuilderCore.StorageComponent, CityBuilderCore.VariantProductionComponent, CityBuilderCore.WorkerUserComponent, CityBuilderManual.Custom.CustomBuildingTrait, CityBuilderTown.ItemConstructionComponent, CityBuilderTown.TownConstructionComponent, CityBuilderTown.TownFarmingComponent, CityBuilderTown.TownHomeComponent, CityBuilderTown.TownMarketComponent, CityBuilderTown.TownWorkComponent, CityBuilderUrban.HouseComponent, and CityBuilderUrban.ShopComponent.
|
inlinevirtual |
deserializes the serialized json data and loads the data as its new state
json |
Implements CityBuilderCore.ISaveData.
Reimplemented in CityBuilderCore.AttackableComponent, CityBuilderCore.CollectionComponent, CityBuilderCore.CyclicWorkerProviderComponent, CityBuilderCore.DefenderAreaComponent, CityBuilderCore.DefenderComponent, CityBuilderCore.DistributionComponent, CityBuilderCore.EmploymentWalkerComponent, CityBuilderCore.EvolutionComponent, CityBuilderCore.GenerationComponent, CityBuilderCore.HousingComponent, CityBuilderCore.HousingPlaceholderComponent, CityBuilderCore.ItemEfficiencyComponent, CityBuilderCore.ItemsRetrieverComponent, CityBuilderCore.MonumentSiteComponent, CityBuilderCore.PooledWorkerProviderComponent, CityBuilderCore.ProductionComponent, CityBuilderCore.ProductionWalkerComponent, CityBuilderCore.RiskerComponent, CityBuilderCore.RiskWalkerComponent, CityBuilderCore.RoadBlockerComponent, CityBuilderCore.ServiceEfficiencyComponent, CityBuilderCore.ServiceWalkerComponent, CityBuilderCore.SpriteRandomizerComponent, CityBuilderCore.StorageComponent, CityBuilderCore.StorageWalkerComponent, CityBuilderCore.TimedReplacementComponent, CityBuilderCore.VariantProductionComponent, CityBuilderCore.VariantProductionWalkerComponent, CityBuilderCore.WalkerComponent, CityBuilderManual.Custom.CustomBuildingComponent, CityBuilderManual.Custom.CustomBuildingTrait, CityBuilderTown.ItemConstructionComponent, CityBuilderTown.TownConstructionComponent, CityBuilderTown.TownFarmingComponent, CityBuilderTown.TownForestingComponent, CityBuilderTown.TownGatheringComponent, CityBuilderTown.TownHomeComponent, CityBuilderTown.TownMarketComponent, CityBuilderTown.TownProductionComponent, CityBuilderTown.TownWorkComponent, CityBuilderUrban.HouseComponent, CityBuilderUrban.RailwayComponent, and CityBuilderUrban.ShopComponent.
|
inlinevirtual |
called after a building has been moved
can be used to register things at the new position
oldPoint | point of the building before moving |
oldRotation | rotation of the building before moving |
Implements CityBuilderCore.IBuildingComponent.
|
inlinevirtual |
called when the building is about to be moved
can be used to remove/deregister stuff from the old position
Implements CityBuilderCore.IBuildingComponent.
|
inlinevirtual |
called when a component gets replaced
use to transfer resources, replace references
replacement |
Implements CityBuilderCore.IBuildingComponent.
Reimplemented in CityBuilderCore.AttackableComponent, CityBuilderCore.CollectionComponent, CityBuilderCore.ConnectionFeederComponent, CityBuilderCore.ConnectionPasserComponent, CityBuilderCore.EvolutionComponent, CityBuilderCore.GenerationComponent, CityBuilderCore.HousingComponent, CityBuilderCore.HousingPlaceholderComponent, CityBuilderCore.ItemEfficiencyComponent, CityBuilderCore.MonumentSiteComponent, CityBuilderCore.ProductionComponent, CityBuilderCore.RiskerComponent, CityBuilderCore.SpriteRandomizerComponent, CityBuilderCore.StorageComponent, CityBuilderCore.VariantProductionComponent, CityBuilderCore.WorkerUserComponent, CityBuilderManual.Custom.CustomBuildingTrait, CityBuilderTown.TownHomeComponent, CityBuilderTown.TownMarketComponent, CityBuilderUrban.HouseComponent, and CityBuilderUrban.ShopComponent.
|
inlineprotected |
registers the building component as a trait so it is globally accessible
usually done in InitializeComponent
T | trait type to register, the building component or an interface it implements |
trait | object that will be registered, almost always this building component |
T | : | IBuildingTrait<T> |
|
inlineprotected |
replaces the reference a trait points to in the global manager
done when a building is replaced(OnReplacing(IBuilding)) so the trait now points to the new component instead of the one that has been removed
T |
trait | |
replacement |
T | : | IBuildingTrait<T> |
|
inlinevirtual |
resumes work in the component after SuspendComponent has been called
Implements CityBuilderCore.IBuildingComponent.
Reimplemented in CityBuilderCore.RoadBlockerComponent, CityBuilderTown.TownFarmingComponent, CityBuilderTown.TownMarketComponent, CityBuilderTown.TownProductionComponent, and CityBuilderTown.TownWorkComponent.
|
virtual |
serializes the objects state(usually to json) and returns it
Implements CityBuilderCore.ISaveData.
Reimplemented in CityBuilderCore.AttackableComponent, CityBuilderCore.CollectionComponent, CityBuilderCore.CyclicWorkerProviderComponent, CityBuilderCore.DefenderAreaComponent, CityBuilderCore.DefenderComponent, CityBuilderCore.DistributionComponent, CityBuilderCore.EmploymentWalkerComponent, CityBuilderCore.EvolutionComponent, CityBuilderCore.GenerationComponent, CityBuilderCore.HousingComponent, CityBuilderCore.HousingPlaceholderComponent, CityBuilderCore.ItemEfficiencyComponent, CityBuilderCore.ItemsRetrieverComponent, CityBuilderCore.MonumentSiteComponent, CityBuilderCore.PooledWorkerProviderComponent, CityBuilderCore.ProductionComponent, CityBuilderCore.ProductionWalkerComponent, CityBuilderCore.RiskerComponent, CityBuilderCore.RiskWalkerComponent, CityBuilderCore.RoadBlockerComponent, CityBuilderCore.ServiceEfficiencyComponent, CityBuilderCore.ServiceWalkerComponent, CityBuilderCore.SpriteRandomizerComponent, CityBuilderCore.StorageComponent, CityBuilderCore.StorageWalkerComponent, CityBuilderCore.TimedReplacementComponent, CityBuilderCore.VariantProductionComponent, CityBuilderCore.VariantProductionWalkerComponent, CityBuilderCore.WalkerComponent, CityBuilderManual.Custom.CustomBuildingComponent, CityBuilderManual.Custom.CustomBuildingTrait, CityBuilderTown.ItemConstructionComponent, CityBuilderTown.TownConstructionComponent, CityBuilderTown.TownFarmingComponent, CityBuilderTown.TownForestingComponent, CityBuilderTown.TownGatheringComponent, CityBuilderTown.TownHomeComponent, CityBuilderTown.TownMarketComponent, CityBuilderTown.TownProductionComponent, CityBuilderTown.TownWorkComponent, CityBuilderUrban.HouseComponent, CityBuilderUrban.RailwayComponent, and CityBuilderUrban.ShopComponent.
|
inlinevirtual |
only called when the building is originally placed, before Initialize
Implements CityBuilderCore.IBuildingComponent.
Reimplemented in CityBuilderTown.TownConstructionComponent.
|
inlinevirtual |
temporarily stops the component from working
Implements CityBuilderCore.IBuildingComponent.
Reimplemented in CityBuilderCore.HousingComponent, CityBuilderCore.RoadBlockerComponent, CityBuilderTown.TownConstructionComponent, CityBuilderTown.TownFarmingComponent, CityBuilderTown.TownForestingComponent, CityBuilderTown.TownGatheringComponent, CityBuilderTown.TownHomeComponent, CityBuilderTown.TownMarketComponent, CityBuilderTown.TownProductionComponent, and CityBuilderTown.TownWorkComponent.
|
inlinevirtual |
termination is performed when the building is destroyed
use to deregister traits, remove references from other systems
Implements CityBuilderCore.IBuildingComponent.
Reimplemented in CityBuilderCore.AttackableComponent, CityBuilderCore.CollectionComponent, CityBuilderCore.ConnectionFeederComponent, CityBuilderCore.ConnectionPasserComponent, CityBuilderCore.HousingComponent, CityBuilderCore.HousingPlaceholderComponent, CityBuilderCore.ItemEfficiencyComponent, CityBuilderCore.MonumentSiteComponent, CityBuilderCore.ProductionComponent, CityBuilderCore.RoadBlockerComponent, CityBuilderCore.StorageComponent, CityBuilderCore.VariantProductionComponent, CityBuilderCore.WorkerUserComponent, CityBuilderManual.Custom.CustomBuildingTrait, CityBuilderTown.ItemConstructionComponent, CityBuilderTown.TownConstructionComponent, CityBuilderTown.TownFarmingComponent, CityBuilderTown.TownForestingComponent, CityBuilderTown.TownGatheringComponent, CityBuilderTown.TownHomeComponent, CityBuilderTown.TownMarketComponent, CityBuilderTown.TownProductionComponent, CityBuilderTown.TownWorkComponent, and CityBuilderUrban.ShopComponent.
|
getset |
the building the component is attached to
is set by the building in awake
Implements CityBuilderCore.IBuildingComponent.
|
getabstract |
unique key used to identify the component in save/load
Implements CityBuilderCore.IBuildingComponent.