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

Detailed Description

building components that have risks that can be reduced by a RiskWalker or are otherwise executed

Inheritance diagram for CityBuilderCore.IRiskRecipient:
CityBuilderCore.IBuildingComponent CityBuilderCore.ISaveData CityBuilderCore.RiskerComponent

Public Member Functions

bool HasRiskValue (Risk risk)
 whether the recipient handles a particular risk
 
float GetRiskValue (Risk risk)
 checks how far a risk in the recipient has progressed
 
void ModifyRisk (Risk risk, float amount)
 changes a risks value in the recipient
risks have to be reduced regularly or they will execute
 
- 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
 

Additional Inherited Members

- 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

◆ GetRiskValue()

float CityBuilderCore.IRiskRecipient.GetRiskValue ( Risk risk)

checks how far a risk in the recipient has progressed

Parameters
riskthe risk for which we want the value
Returns
value in percent of how close the risk is to executing

Implemented in CityBuilderCore.RiskerComponent.

◆ HasRiskValue()

bool CityBuilderCore.IRiskRecipient.HasRiskValue ( Risk risk)

whether the recipient handles a particular risk

Parameters
riskthe risk to check
Returns
true if the passed risk is present in the recipient

Implemented in CityBuilderCore.RiskerComponent.

◆ ModifyRisk()

void CityBuilderCore.IRiskRecipient.ModifyRisk ( Risk risk,
float amount )

changes a risks value in the recipient
risks have to be reduced regularly or they will execute

Parameters
riskthe risk that will have its value changed
amountpositive value will move the risk closer to executing, negative value prevent it from happening

Implemented in CityBuilderCore.RiskerComponent.