Skip to content

Game.Prefabs.ServiceFeeParameterPrefab

Assembly: Assembly-CSharp.dll
Namespace: Game.Prefabs

Type: class

Base: PrefabBase

Summary:
Prefab that defines configurable service fee parameters (electricity, water, healthcare, education, garbage, fire/police response) used to initialize ECS component ServiceFeeParameterData on a prefab entity. This class exposes UnityEngine serializable fields (AnimationCurve, FeeParameters, int4) for designers and converts them into ECS-safe types (e.g., AnimationCurve1) during LateInitialize so they can be stored on entities.


Fields

  • public FeeParameters m_ElectricityFee
    This FeeParameters structure controls the electricity fee tiers/values applied for electricity service.

  • public AnimationCurve m_ElectricityFeeConsumptionMultiplier
    Defines how electricity consumption (0–200%) affects the effective electricity fee. Converted to AnimationCurve1 in LateInitialize.

  • public FeeParameters m_HealthcareFee
    Fee parameters for healthcare service.

  • public FeeParameters m_BasicEducationFee
    Fee parameters for basic (primary) education.

  • public FeeParameters m_SecondaryEducationFee
    Fee parameters for secondary education.

  • public FeeParameters m_HigherEducationFee
    Fee parameters for higher education.

  • public FeeParameters m_GarbageFee
    Tooltip: "This is used by budget UI, not in gameplay, use the other two garbage fee for gameplay garbage fee" — this field is primarily for budget UI display and may not represent in-game per-building garbage gameplay fee.

  • public int4 m_GarbageFeeRCIO
    Tooltip: "Defines the garbage fee of RCIO zone tpye per building, x-residential,y-commercial,z-industrial,w-office" — per-zone-type (Residential, Commercial, Industrial, Office) garbage fee values stored as Unity.Mathematics.int4.

  • public FeeParameters m_WaterFee
    Fee parameters for water service.

  • public AnimationCurve m_WaterFeeConsumptionMultiplier
    Defines how water consumption (0–200%) affects the effective water fee. Converted to AnimationCurve1 in LateInitialize.

  • public FeeParameters m_FireResponseFee
    Fee parameters for fire response service.

  • public FeeParameters m_PoliceFee
    Fee parameters for police service.

Properties

  • This class does not declare any managed properties. It exposes configuration via public serialized fields that are transferred into the ECS component ServiceFeeParameterData during LateInitialize.

Constructors

  • public ServiceFeeParameterPrefab()
    Default parameterless constructor (inherited behavior). No custom construction logic is implemented in the source — initialization of ECS component data occurs in LateInitialize.

Methods

  • public override void GetPrefabComponents(HashSet<ComponentType> components)
    Adds ServiceFeeParameterData as a read/write component requirement for this prefab. This tells prefab initialization that entities created from this prefab will contain the ServiceFeeParameterData component.

  • public override void LateInitialize(EntityManager entityManager, Entity entity)
    Converts the prefab's managed fields into a ServiceFeeParameterData instance and writes it to the provided entity via entityManager.SetComponentData. Specifically:

  • Copies FeeParameters fields directly.
  • Converts AnimationCurve fields to AnimationCurve1 (ECS-compatible wrapper) for electricity and water consumption multipliers.
  • Copies m_GarbageFeeRCIO (int4) as-is.
  • This method is where prefab authoring data is materialized into the entity for runtime use.

Usage Example

// Typical flow (handled by the prefab system):
// - Prefab author sets up the public fields in the inspector.
// - Prefab system calls GetPrefabComponents and LateInitialize to attach ServiceFeeParameterData to the entity.

// Example: reading the data after LateInitialize has run
ServiceFeeParameterData data = entityManager.GetComponentData<ServiceFeeParameterData>(entity);
// Now `data` contains the FeeParameters and AnimationCurve1 values set from the prefab fields.

Additional notes: - Pay attention to the tooltip on m_GarbageFee — it is used for budget UI and may not reflect in-game per-building garbage gameplay fees; use the RCIO garbage fee (m_GarbageFeeRCIO) or other gameplay-specific fields if implementing gameplay logic. - AnimationCurve fields are converted to AnimationCurve1 for ECS compatibility; if you rely on curves at runtime, read them from the ServiceFeeParameterData component rather than the prefab's managed AnimationCurve.