void OnTriggerEnter(Collider collider) { if (collider.gameObject.name == "FireBox" && alarms.fireDetected && !haveExtinguisher) { fireBox = collider.gameObject.GetComponent <FireBox>(); TakeExtinguisher(); } }
// brief Allows inital data values to be set // param bool If the cell is already alight // param GameObject The GameObject/Prefab to be used for the fire // param CellData The cell data // param String Name of the terrain // param Vector2[] The positions within the cell a fire should be instantiated, requires at least 1 position in the cell public void SetupCell(bool alight, GameObject fire, CellData data, string terrainName, Vector2[] firesPositionsInCell) { m_isAlight = alight; m_firePrefab = fire; m_fires = new GameObject[firesPositionsInCell.Length]; m_firesPositions = firesPositionsInCell; m_HP = data.HP; m_fuel = data.fuel; m_extinguishThreshold = data.fuel * data.threshold; m_moisture = data.moisture; m_fireBox = new FireBox(); m_fireBox.Init(transform.position, terrainName); float boxExtents = data.cellSize / 2.0f; m_fireBox.radius = new Vector3(boxExtents, boxExtents, boxExtents); m_combustionConstant = data.combustionValue; SetInitialFireValues(data.airTemperature, data.propagationSpeed); }
// brief Update that is called by a FireGrid // param FireGrassRemover A script that can remove grass from the terrain public void GridUpdate(FireGrassRemover script) { // Combustion will not start until ignition() is called in heatsUp() - called by FireGrid // this will ensure that no fire is instantiated and is deleted at the right time Combustion(); if (m_extinguish && !m_extingushed) { // delete fire particle system script.DeleteGrassOnPosition(transform.position); m_extingushed = true; if (m_fireBox != null) { m_fireBox = null; } Delete(); } }