Skip to content

Game.Prefabs.BuildingModifierInfo

Assembly: Assembly-CSharp (game assembly)
Namespace: Game.Prefabs

Type: class

Base: System.Object

Summary:
Serializable data container that describes a single modifier applicable to buildings. It specifies which building attribute is affected (m_Type), how the modifier value is applied (m_Mode), and the numeric range/strength of the modifier (m_Range). This class is a plain-old-data holder used by prefab or configuration systems when defining building modifiers.


Fields

  • public Game.Buildings.BuildingModifierType m_Type
    Specifies which building attribute or aspect the modifier targets. This is an enum (defined in Game.Buildings) that identifies the modifier category (e.g., production, energy use, attractiveness — use the actual enum members available in the game).

  • public Game.Buildings.ModifierValueMode m_Mode
    Determines how the modifier value should be interpreted/applied (for example: Add, Multiply, Set). This is an enum (defined in Game.Buildings) that controls how m_Range values affect the target attribute.

  • public Colossal.Mathematics.Bounds1 m_Range
    Numeric range or value for the modifier. Bounds1 (from Colossal.Mathematics) typically represents a min/max or a single value range describing the magnitude of the modifier. Interpret the fields of Bounds1 according to the Colossal.Mathematics definition (e.g., min/max or value depending on usage).

Properties

  • This class does not define any properties; it exposes public fields for direct serialization and simple usage.

Constructors

  • public BuildingModifierInfo()
    Default parameterless constructor (compiler-provided). Creates an instance with default enum values and a default Bounds1. After construction, populate fields with appropriate enum members and range values before use.

Methods

  • This class defines no methods. It is a simple serializable data holder.

Usage Example

// create and initialize a modifier
var modifier = new Game.Prefabs.BuildingModifierInfo
{
    // use actual enum members from Game.Buildings
    m_Type = Game.Buildings.BuildingModifierType.SomeModifierType,
    m_Mode = Game.Buildings.ModifierValueMode.Add, // or Multiply/Set, etc.
    // initialize Bounds1 per its constructor or fields (example constructor shown; adjust to actual API)
    m_Range = new Colossal.Mathematics.Bounds1(0f, 10f)
};

// example: attach this modifier to a prefab definition or apply it through your mod logic
// prefab.Modifiers.Add(modifier);

Notes: - The class is marked [Serializable], so it is intended for serialization (prefab files, save data, or inspector-driven configurations). - Check the definitions of BuildingModifierType, ModifierValueMode, and Bounds1 in the game's assemblies to choose appropriate enum members and to construct Bounds1 correctly.