Skip to main content

FireExtinguisher

A class in Root.Township, Alta.Heat.

A trigger that smothers fires: any asphyxiable HeatSourceBase whose heat point collider enters it is asphyxiated until it leaves.

Constructors​

MemberWhat it is
FireExtinguisher()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

3 private and internal fields
MemberWhat it is
private int heatPointLayerIndex of the HeatPoint layer, set in Awake.
private Dictionary<Collider, HeatSourceBase> sourcesMapHeat sources currently being smothered, keyed by the collider that entered.
private Coroutine validationRoutineThe running EnsureHeatSourcesAreValid coroutine, or null when nothing is held.

Methods​

4 private and internal methods
MemberWhat it is
private void Awake()Caches the HeatPoint layer index.
private IEnumerator EnsureHeatSourcesAreValid() (iterator)Coroutine that runs while any source is held, releasing and dropping entries whose source was destroyed or whose collider was disabled.
private void OnTriggerEnter(Collider other)When a collider on the HeatPoint layer enters, finds its HeatSourceBase (on the rigidbody or the collider) and asphyxiates it if it can be.
private void OnTriggerExit(Collider other)Releases the asphyxiation on the heat source tied to the leaving collider.