// brief Gets the visual manager and sets a reference to it void GetVisualManager() { if (m_visualMgr == null) { m_visualMgr = m_fire.GetComponent <FireVisualManager>(); } }
// brief The heats up step, removing the cell's hit points until the ignition temperature is met public void HeatsUp() { if (m_instantiatedInCell == false) { InstantiateFire(transform.position, m_firePrefab); m_instantiatedInCell = true; m_fireProcessHappening = true; for (int i = 0; i < m_fires.Length; i++) { FireVisualManager visualMgr = m_fires[i].GetComponent <FireVisualManager>(); visualMgr.SetHeatState(); } } if (m_ignitionTemperature > 0.0f) { m_ignitionTemperature -= m_fireTemperature * Time.deltaTime; } if (m_ignitionTemperature <= 0.0f && !m_isAlight) { m_fireJustStarted = true; Ignition(); } }
// brief The combustion step, if the fire is alight consume fuel in the cell until the fuel has run out void Combustion() { if (m_isAlight) { m_fireJustStarted = false; // Use fuel m_fuel -= m_combustionConstant * Time.deltaTime; // Check if threshold has been met, if so set Fire Visual Manager state if (m_fuel < m_extinguishThreshold) { for (int i = 0; i < m_fires.Length; i++) { FireVisualManager visualMgr = m_fires[i].GetComponent <FireVisualManager>(); visualMgr.SetExtingushState(); } } // Run out of fuel? If so set internal states if (m_fuel <= 0.0f) { m_isAlight = false; m_extinguish = true; } // is there a collision in this cell with a GameObject with a FireNodeChain m_fireBox.DetectionTest(); } }
// brief The ignition step, if a fire has just started in the cell set internal and Fire Visual Manager states. Ignition() should be // called rather then this method directly // param Vector3 Position // param GameObject Fire GameObject/Prefab public void Ignition(Vector3 position, GameObject Fire) { if (m_fireJustStarted) { m_isAlight = true; for (int i = 0; i < m_fires.Length; i++) { FireVisualManager visualMgr = m_fires[i].GetComponent <FireVisualManager>(); visualMgr.SetIgnitionState(); } } }