Skip to content

Game.Prefabs.BuildingConfigurationData

Assembly: Game
Namespace: Game.Prefabs

Type: struct

Base: IComponentData, IQueryTypeParameter

Summary:
Component data that contains configuration references and numeric parameters for building behavior and visual/audio effects. This struct groups various Entity references to notification prefabs, construction/collapse visuals/surfaces, utility connection lanes, and numeric tuning values (increments, decrements, delays, densities) used by building-related systems.


Fields

  • public int m_BuildingConditionIncrement
    Configures how much the building condition increases when repaired or serviced. Used by systems that adjust building condition values.

  • public int m_BuildingConditionDecrement
    Configures how much the building condition decreases per deterioration event/tick. Used by decay/maintenance logic.

  • public Entity m_AbandonedCollapsedNotification
    Entity reference (usually a notification prefab) to spawn or send when a building has both been abandoned and collapsed.

  • public Entity m_AbandonedNotification
    Entity reference for the notification spawned when a building becomes abandoned.

  • public Entity m_CondemnedNotification
    Entity reference for the notification spawned when a building is condemned.

  • public Entity m_LevelUpNotification
    Entity reference for the notification spawned when a building levels up.

  • public Entity m_TurnedOffNotification
    Entity reference for the notification spawned when a building is turned off (e.g., services disabled).

  • public Entity m_ElectricityConnectionLane
    Entity reference describing the lane/prefab used to visualize or process electricity connections for this building.

  • public Entity m_SewageConnectionLane
    Entity reference for sewage connection visualization/processing.

  • public Entity m_WaterConnectionLane
    Entity reference for water connection visualization/processing.

  • public uint m_AbandonedDestroyDelay
    Unsigned integer representing the delay before an abandoned building is destroyed/removed. The exact unit (frames, seconds, ticks) depends on the consuming systems.

  • public Entity m_HighRentNotification
    Entity reference for a notification when rent is high or similar rent-based events occur.

  • public Entity m_DefaultRenterBrand
    Entity reference used to identify the default renter brand or branding prefab associated with the building.

  • public Entity m_ConstructionSurface
    Entity reference for the construction surface prefab/visual used while building is under construction.

  • public Entity m_ConstructionBorder
    Entity reference for the construction border visual around the building site.

  • public Entity m_ConstructionObject
    Entity reference for construction-related props/objects (e.g., scaffolding, cranes).

  • public Entity m_CollapsedObject
    Entity reference for the collapsed building object/prefab used when a building collapses.

  • public Entity m_CollapseVFX
    Entity reference for visual effects to play when a building collapses.

  • public Entity m_CollapseSFX
    Entity reference for the collapse sound effect prefab/entity.

  • public float m_CollapseSFXDensity
    Float tuning value controlling how frequently or densely collapse SFX are played/spawned; interpretation is implementation-specific (e.g., per-area density multiplier).

  • public Entity m_CollapsedSurface
    Entity reference for the ground/surface decal or prefab left after collapse.

  • public Entity m_FireLoopSFX
    Entity reference for a looping fire sound effect used while a building is on fire.

  • public Entity m_FireSpotSFX
    Entity reference for spot fire sound effects used for localized fire audio events.

Properties

  • None
    This struct exposes only public fields and implements IComponentData / IQueryTypeParameter for use in ECS. There are no properties defined.

Constructors

  • public BuildingConfigurationData()
    The struct has the implicit default constructor that initializes numeric fields to zero and Entity fields to Entity.Null. Use an explicit initializer when adding the component to an entity to set meaningful references/values.

Methods

  • None
    This is a plain data component with no methods. Behavior is provided by systems that read or write this component.

Usage Example

// Example: Adding and initializing the component on an entity in a system or conversion workflow
var config = new BuildingConfigurationData
{
    m_BuildingConditionIncrement = 10,
    m_BuildingConditionDecrement = 1,
    m_AbandonedDestroyDelay = 600u, // interpret per consuming system (e.g., ticks)
    m_CollapseSFXDensity = 0.75f,
    m_AbandonedNotification = abandonedNotificationEntity,
    m_CollapseVFX = collapseVfxEntity,
    m_CollapseSFX = collapseSfxEntity,
    m_FireLoopSFX = fireLoopSfxEntity,
    m_FireSpotSFX = fireSpotSfxEntity,
    m_ElectricityConnectionLane = electricityLaneEntity,
    m_WaterConnectionLane = waterLaneEntity,
    m_SewageConnectionLane = sewageLaneEntity,
    // ...set other Entity references as appropriate
};

entityManager.AddComponentData(buildingEntity, config);

// Example: reading the component inside a system
Entities
    .WithReadOnly(configQuery)
    .ForEach((ref BuildingConfigurationData cfg, in SomeBuildingState state) =>
    {
        if (state.IsCollapsed)
        {
            // Spawn collapse VFX/SFX using cfg.m_CollapseVFX / cfg.m_CollapseSFX
        }
    }).Run();

Notes: - Entity fields typically point to prefab entities (notifications, VFX/SFX prefabs, surfaces) that systems instantiate or trigger. - Because this type implements IComponentData it should be used with the EntityManager / ECS systems; IQueryTypeParameter allows it to be used directly in certain query contexts. - Default values are Entity.Null (for Entity fields) and zero for numeric fields; always initialize fields you rely on before use.