Game.Prefabs.BuildingModifierData
Assembly: Assembly-CSharp.dll
Namespace: Game.Prefabs
Type: struct
Base: Unity.Entities.IBufferElementData
Summary:
BuildingModifierData is a buffer element struct used by building prefabs to describe one modifier that can be applied to a building. Each element encodes which modifier is targeted (m_Type), how the modifier value should be interpreted (m_Mode), and the numeric range of values (m_Range). The type is marked with [InternalBufferCapacity(0)] so the dynamic buffer has no inline storage and will allocate separately when used.
Fields
-
public BuildingModifierType m_Type
Specifies which modifier this entry represents (for example: production, pollution, power usage, etc.). The concrete enum values are defined in BuildingModifierType elsewhere in the codebase/mod API. -
public ModifierValueMode m_Mode
Specifies how the modifier value is applied (for example: add, multiply, set, or other modes depending on the enum ModifierValueMode). -
public Bounds1 m_Range
Defines the numeric range of the modifier values (min/max). Bounds1 comes from Colossal.Mathematics and represents a 1-dimensional bounds (typically holding a minimum and maximum float).
Properties
- This struct does not define properties. It is a plain IBufferElementData with public fields.
Constructors
public BuildingModifierData(BuildingModifierType type, ModifierValueMode mode, Bounds1 range)
Creates a new BuildingModifierData element with the specified modifier type, value mode, and numeric range.
Methods
- No instance methods are defined on this struct. It is a simple data container implementing IBufferElementData and intended to be stored in an entity DynamicBuffer
.
Usage Example
// Example: add a modifier buffer element to an entity via EntityManager
var buffer = entityManager.AddBuffer<Game.Prefabs.BuildingModifierData>(entity);
var range = new Colossal.Mathematics.Bounds1(minValue, maxValue);
var modifier = new Game.Prefabs.BuildingModifierData(
BuildingModifierType.PowerConsumption,
ModifierValueMode.Multiply,
range
);
buffer.Add(modifier);
Notes: - The [InternalBufferCapacity(0)] attribute indicates no inline capacity; expect separate allocation for buffer contents when you add elements. - BuildingModifierType, ModifierValueMode and Bounds1 are defined elsewhere in the game's API — consult those types for exact enum values and semantics when creating modifiers.