Skip to content

Game.Prefabs.CityModifierData

Assembly: Assembly-CSharp (game assembly)

Namespace: Game.Prefabs

Type: public struct CityModifierData

Base: Unity.Entities.IBufferElementData

Summary:
CityModifierData is a Unity ECS buffer element that represents a single city modifier entry used by the game's city systems. Each element describes what kind of modifier it is, how the modifier value should be interpreted/applied, and the applicable numeric range. The struct is marked with [InternalBufferCapacity(0)], so the dynamic buffer has no inline storage and will allocate externally when elements are added.


Fields

  • public CityModifierType m_Type
    Specifies which modifier this entry represents (e.g., population, traffic, pollution — defined by the CityModifierType enum). Determines the target/meaning of the modifier value.

  • public ModifierValueMode m_Mode
    Indicates how the value should be interpreted/applied (for example absolute value, additive, multiplicative, percentage — defined by the ModifierValueMode enum).

  • public Bounds1 m_Range
    A 1D bounds/value range that constrains the modifier (typically min/max or range of effect). Uses Colossal.Mathematics.Bounds1 to express the numeric interval.

Properties

  • None.
    This struct only exposes public fields and implements IBufferElementData for use in dynamic buffers.

Constructors

  • public CityModifierData(CityModifierType type, ModifierValueMode mode, Bounds1 range)
    Initializes the CityModifierData with the specified type, mode and range.

Methods

  • None.
    This is a plain data container intended for storage in an ECS DynamicBuffer; behavior/logic that applies modifiers lives elsewhere in game systems.

Usage Example

// Example: adding a CityModifierData element to an entity's dynamic buffer
var buffer = entityManager.AddBuffer<CityModifierData>(cityEntity);

// Create a bounds (example values) — Bounds1 constructor depends on Colossal.Mathematics API
var valueRange = new Bounds1(0f, 100f);

// Add a modifier entry (replace enum values with actual in-game enums)
buffer.Add(new CityModifierData(
    CityModifierType.Population,      // example enum value
    ModifierValueMode.Additive,       // example enum value
    valueRange
));

Additional notes: - The [InternalBufferCapacity(0)] attribute sets the inline capacity to zero — expect heap allocation for buffer storage when elements are added. - This struct is intended to be used inside Unity.Entities.DynamicBuffer attached to entities representing prefabs or city-related objects.