Game.Prefabs.BuildingEfficiencyParametersPrefab
Assembly: Assembly-CSharp.dll
Namespace: Game.Prefabs
Type: class
Base: PrefabBase
Summary:
Prefab component that defines global/default building efficiency parameters used by buildings (service efficiency, penalties, delays and curves). At initialization it registers the BuildingEfficiencyParameterData component on the prefab's entity and writes these values into that ECS component (converting Unity AnimationCurve to the internal AnimationCurve1 representation). These parameters control how various factors (electricity, water, sewage, garbage, mail, telecom, employees, sickness, fees) affect building efficiency in-game.
Fields
-
public UnityEngine.AnimationCurve m_ServiceBudgetEfficiencyFactor
AnimationCurve mapping service budget (0.5–1.5) to a service budget efficiency factor. Converted to AnimationCurve1 when stored in ECS data. -
public float m_LowEfficiencyThreshold = 0.15f
If building efficiency drops below this value, a "low efficiency" flag is applied (used to disable certain VFX/SFX). Range: [0,1]. -
public float m_ElectricityPenalty = 0.5f
Efficiency penalty applied when insufficient electricity is supplied. Range: [0,1]. -
public short m_ElectricityPenaltyDelay = 32
Interval in ticks until the electricity penalty is fully applied. One tick ≈ 1.42 in-game minutes. -
public UnityEngine.AnimationCurve m_ElectricityFeeFactor
AnimationCurve that defines how electricity fee (0–200%) correlates to an electricity fee efficiency factor. Converted to AnimationCurve1 in ECS data. -
public float m_WaterPenalty = 0.5f
Efficiency penalty when not enough water is supplied. Range: [0,1]. -
public byte m_WaterPenaltyDelay = 32
Delay in ticks until the water penalty is fully applied. One tick ≈ 1.42 in-game minutes. Note: stored as byte here but cast to int when written into ECS data. -
public float m_WaterPollutionPenalty = 0.5f
Efficiency penalty when supplied fresh water is polluted. Range: [0,1]. -
public float m_SewagePenalty = 0.5f
Efficiency penalty when sewage is not handled. Range: [0,1]. -
public byte m_SewagePenaltyDelay = 32
Delay in ticks until the sewage penalty is fully applied. One tick ≈ 1.42 in-game minutes. Stored as byte here but cast to int when written into ECS data. -
public UnityEngine.AnimationCurve m_WaterFeeFactor
AnimationCurve that defines how water fee (0–200%) correlates to a water fee efficiency factor. Converted to AnimationCurve1 for ECS storage. -
public float m_GarbagePenalty = 0.5f
Efficiency penalty when garbage accumulates. Range: [0,1]. -
public int m_NegligibleMail = 20
Amount of mail tolerated by the building before efficiency starts to drop. Minimum 0. -
public float m_MailEfficiencyPenalty = 0.1f
Efficiency penalty when too much mail accumulates. Range: [0,1]. -
public float m_TelecomBaseline = 0.3f
Minimum telecom network quality required before telecom-related efficiency penalties are applied. Range: [0,1]. -
public float m_MissingEmployeesEfficiencyPenalty = 0.9f
Efficiency penalty (scales proportionally) when a building has fewer employees than required. Range: [0,1]. -
public short m_MissingEmployeesEfficiencyDelay = 16
Delay in ticks until the "not enough employees" penalty is fully applied. Note: 512 ticks per in-game day — so convert accordingly. -
public short m_ServiceBuildingEfficiencyGracePeriod = 16
Extra grace period in ticks for service buildings before the "not enough employees" penalty starts to drop. Minimum 0. -
public float m_SickEmployeesEfficiencyPenalty = 0.9f
Efficiency penalty (scales proportionally) when employees are sick. Range: [0,1].
Properties
This prefab class does not declare C# properties. It exposes a set of public fields that are written into the BuildingEfficiencyParameterData ECS component during LateInitialize.
Constructors
public BuildingEfficiencyParametersPrefab()
Default constructor (implicit). This class is a Unity component/prefab class (inherits from PrefabBase) and is typically instantiated by Unity's prefab system or loaded from game data.
Methods
-
public override void GetPrefabComponents(HashSet<ComponentType> components)
Adds the BuildingEfficiencyParameterData component type to the provided set so the prefab entity will include that component. Calls base.GetPrefabComponents first. -
public override void LateInitialize(EntityManager entityManager, Entity entity)
Called during prefab initialization. Converts the Unity AnimationCurve fields into AnimationCurve1 and writes a BuildingEfficiencyParameterData instance into the provided entity via entityManager.SetComponentData(...). Note: some fields are cast (e.g., byte -> int) when populating the ECS struct.
Usage Example
// The prefab automatically writes its values into the BuildingEfficiencyParameterData ECS component
public override void LateInitialize(EntityManager entityManager, Entity entity)
{
base.LateInitialize(entityManager, entity);
entityManager.SetComponentData(entity, new BuildingEfficiencyParameterData
{
m_ServiceBudgetEfficiencyFactor = new AnimationCurve1(m_ServiceBudgetEfficiencyFactor),
m_LowEfficiencyThreshold = m_LowEfficiencyThreshold,
m_ElectricityPenalty = m_ElectricityPenalty,
m_ElectricityPenaltyDelay = m_ElectricityPenaltyDelay,
m_ElectricityFeeFactor = new AnimationCurve1(m_ElectricityFeeFactor),
m_WaterPenalty = m_WaterPenalty,
m_WaterPenaltyDelay = (int)m_WaterPenaltyDelay,
m_WaterPollutionPenalty = m_WaterPollutionPenalty,
m_SewagePenalty = m_SewagePenalty,
m_SewagePenaltyDelay = (int)m_SewagePenaltyDelay,
m_WaterFeeFactor = new AnimationCurve1(m_WaterFeeFactor),
m_GarbagePenalty = m_GarbagePenalty,
m_NegligibleMail = m_NegligibleMail,
m_MailEfficiencyPenalty = m_MailEfficiencyPenalty,
m_TelecomBaseline = m_TelecomBaseline,
m_MissingEmployeesEfficiencyPenalty = m_MissingEmployeesEfficiencyPenalty,
m_MissingEmployeesEfficiencyDelay = m_MissingEmployeesEfficiencyDelay,
m_ServiceBuildingEfficiencyGracePeriod = m_ServiceBuildingEfficiencyGracePeriod,
m_SickEmployeesEfficiencyPenalty = m_SickEmployeesEfficiencyPenalty
});
}
Additional notes: - AnimationCurve fields are converted to AnimationCurve1 (game-specific lightweight curve representation) before being stored in ECS data. - Delays and timing are expressed in "ticks". For some penalties a tick ≈ 1.42 in-game minutes; employee-related delays reference 512 ticks per in-game day. Adjust values accordingly when tuning parameters.