Skip to content

Game.Prefabs.ZoneServiceConsumptionData

Assembly: Assembly-CSharp (may vary by project)
Namespace: Game.Prefabs

Type: struct

Base: implements Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter

Summary:
Represents aggregated service-consumption values for a zone/prefab. Instances are plain-value ECS components carrying numeric amounts used by simulation systems to compute upkeep, resource use (electricity, water), garbage accumulation, and telecom demand. All fields are simple floats and default to 0.0 when the component is default-constructed. These values are game-specific (per-frame or per-simulation-step depending on the consuming systems) and are intended to be read/updated by systems that manage zone services and resource accounting.


Fields

  • public float m_Upkeep
    Stores the upkeep cost/amount associated with this zone/prefab. Typical interpretation: monetary or maintenance cost contribution.

  • public float m_ElectricityConsumption
    Amount of electricity consumed by the zone/prefab. Units are game-specific (float).

  • public float m_WaterConsumption
    Amount of water consumed by the zone/prefab.

  • public float m_GarbageAccumulation
    Rate or amount of garbage accumulated by the zone/prefab.

  • public float m_TelecomNeed
    Represents telecom (internet/phone) demand for the zone/prefab.

Properties

  • This type defines no managed properties; it exposes public fields only.
    Implements IQueryTypeParameter to allow usage as a query parameter type in ECS queries.

Constructors

  • public ZoneServiceConsumptionData()
    Default (implicit) value-type constructor. All float fields are initialized to 0.0f.

Methods

  • This struct defines no methods. It is a plain data container (IComponentData).

Usage Example

// Add the component to an entity (EntityManager or in conversion)
var data = new ZoneServiceConsumptionData {
    m_Upkeep = 5.0f,
    m_ElectricityConsumption = 12.5f,
    m_WaterConsumption = 3.0f,
    m_GarbageAccumulation = 0.8f,
    m_TelecomNeed = 2.0f
};
entityManager.AddComponentData(entity, data);

// Read / modify inside a SystemBase
protected override void OnUpdate()
{
    // Increase electricity consumption by 10% for all entities with this component
    Entities.ForEach((ref ZoneServiceConsumptionData zsc) =>
    {
        zsc.m_ElectricityConsumption *= 1.1f;
    }).ScheduleParallel();
}

Additional notes: - As an IComponentData value type, this component is efficient to copy and store in ECS archetypes. - The semantic meaning of the floats (per-second, per-tick, per-building, aggregated-per-zone, etc.) is defined by the systems that produce/consume these values; consult the consuming systems for exact interpretation.