Game.Prefabs.FireConfigurationPrefab
Assembly: Assembly-CSharp (Game)
Namespace: Game.Prefabs
Type: class
Base: PrefabBase
Summary:
A prefab asset that defines global fire-related configuration used by the game's fire simulation. This prefab exposes inspector-configurable values for structural integrity (defaults and building/level-specific values), response time range and modifiers, forest-fire hazard curves, notification prefabs for fire and burned-down events, and the death rate for fire accidents. During initialization the prefab writes these settings into a FireConfigurationData component on the corresponding ECS entity and registers dependencies on the notification prefabs.
Fields
-
public NotificationIconPrefab m_FireNotificationPrefab
Reference to the notification prefab shown when a fire occurs. The prefab is added as a dependency and resolved to an entity in LateInitialize. -
public NotificationIconPrefab m_BurnedDownNotificationPrefab
Reference to the notification prefab shown when a building has burned down. Also added to prefab dependencies and resolved to an entity. -
public float m_DefaultStructuralIntegrity = 3000f
Default structural integrity value used for objects that don't have a more specific entry. -
public float m_BuildingStructuralIntegrity = 15000f
Default structural integrity value for buildings. -
public float m_StructuralIntegrityLevel1 = 12000f
public float m_StructuralIntegrityLevel2 = 13000f
public float m_StructuralIntegrityLevel3 = 14000f
public float m_StructuralIntegrityLevel4 = 15000f
-
public float m_StructuralIntegrityLevel5 = 16000f
Per-level structural integrity presets (levels 1–5). These are inspector-exposed tuning values used by building/fire systems. -
public Bounds1 m_ResponseTimeRange = new Bounds1(3f, 30f)
Range (min/max) for emergency response time, exposed as a Bounds1 structure. -
public float m_TelecomResponseTimeModifier = -0.15f
Modifier applied to response time when telecoms improve response (negative reduces response time). -
public float m_DarknessResponseTimeModifier = 0.1f
Modifier applied to response time due to darkness (increases response time). -
public AnimationCurve m_TemperatureForestFireHazard
Animation curve defining forest-fire hazard factor as a function of temperature. Used to evaluate forest fire risk. -
public AnimationCurve m_NoRainForestFireHazard
Animation curve defining additional forest-fire hazard factor when there is no rain. -
public float m_DeathRateOfFireAccident = 0.01f
Base death rate used when calculating casualties from fire accidents.
Properties
- This class does not declare any public properties. It exposes configuration via public fields and populates a FireConfigurationData component during LateInitialize.
Constructors
public FireConfigurationPrefab()
Default constructor (no explicit initialization beyond field defaults). This prefab is intended to be configured in the editor; runtime initialization happens via the overridden prefab lifecycle methods.
Methods
-
public override void GetDependencies(System.Collections.Generic.List<PrefabBase> prefabs)
Adds the referenced notification prefabs (m_FireNotificationPrefab and m_BurnedDownNotificationPrefab) to the provided dependency list so they are available/resolved when this prefab is initialized. -
public override void GetPrefabComponents(System.Collections.Generic.HashSet<ComponentType> components)
Registers the FireConfigurationData component type with the prefab system so that entities created from this prefab will include a FireConfigurationData component. -
public override void LateInitialize(Unity.Entities.EntityManager entityManager, Unity.Entities.Entity entity)
Resolves referenced notification prefabs to entities via PrefabSystem, copies all inspector-configured values into a FireConfigurationData instance, and writes that component data to the provided ECS entity using entityManager.SetComponentData. This is the main runtime glue that transfers authoring data into ECS.
Usage Example
// Example: reading the runtime FireConfigurationData from the prefab entity
// (can be done from a system once prefabs are initialized)
EntityManager em = World.DefaultGameObjectInjectionWorld.EntityManager;
// 'prefabEntity' is the ECS entity that corresponds to the FireConfigurationPrefab.
// How you obtain it depends on context (e.g. PrefabSystem.GetEntity(prefabAsset)).
FireConfigurationData cfg = em.GetComponentData<FireConfigurationData>(prefabEntity);
Debug.Log($"Default structural integrity: {cfg.m_DefaultStructuralIntegrity}");
Debug.Log($"Response time range: {cfg.m_ResponseTimeRange.min} - {cfg.m_ResponseTimeRange.max}");