コード例 #1
0
    // brief The combustion step, triggered after the fire is alight
    void Combustion()
    {
        if (m_isAlight)
        {
            m_fireJustStarted = false;

            m_fuel -= m_combustionRateValue * Time.deltaTime;

            if (m_fuel < m_extinguishThreshold)
            {
                // Should be valid as getFireManager() called in ingition before this function is called
                if (m_visualMgr != null)
                {
                    m_visualMgr.SetExtingushState();
                }
            }

            if (m_fuel <= 0.0f)
            {
                m_isAlight    = false;
                m_extingushed = true;

                KillFlames();
                m_clean = true;
            }
        }
    }
コード例 #2
0
    // 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();
        }
    }