public void onNextFrame(float tick)
{
    bool bEnable = sim.getCurSunElevation() <= m_fElevationLimit;
    if (bEnable != m_bEnabled)
    {
      if (bEnable)
      {
        // switching on
        m_fCurBrightness = c_fStartBrightness;
        m_fNewBrightness = 1.0f;
        m_bEnabled = true;
      }
      else
      {
        // switching off
        m_fNewBrightness = 0.0f;
        m_bEnabled = false;
      }
    } 
    
    if (m_fCurBrightness < m_fNewBrightness)
    {
      // switching on
      m_fCurBrightness += tick / c_fSwitchOnTime;
      if (m_fCurBrightness > m_fNewBrightness)
      {
        m_fCurBrightness = m_fNewBrightness;
      }
    }
    else if (m_fCurBrightness > m_fNewBrightness)
    {
      // switching off
      m_fCurBrightness -= tick / c_fSwitchOffTime;
      if (m_fCurBrightness < m_fNewBrightness)
      {
        m_fCurBrightness = m_fNewBrightness;
      }
    }
      
    bEnable = m_fCurBrightness > 0;
    
    m_aLight.setEnabled(bEnable);
    
    if (bEnable)
    {
      m_aLight.setColor(m_fCurBrightness * m_aOrgColor.x, m_fCurBrightness * m_aOrgColor.y, m_fCurBrightness * m_aOrgColor.z);
    }
    
    // This controls the fading between normal object color and completely white, using a special material (fade_to_white)
    m_aEntCol.w = m_fCurBrightness;
    m_aSCO.setEntityColor(m_aEntCol);
}public void onNextFrame(float tick)
{
    m_aLight.setEnabled(true);
}public void onNextFrame(float tick)
{
    bool bEnable = sim.getCurSunElevation() <= m_fElevationLimit;
    if (bEnable != m_bEnabled)
    {
      if (bEnable)
      {
        // switching on
        m_fCurBrightness = c_fStartBrightness;
        m_fNewBrightness = 1.0f;
        m_bEnabled = true;
      }
      else
      {
        // switching off
        m_fNewBrightness = 0.0f;
        m_bEnabled = false;
      }
    } 
    
    if (m_fCurBrightness < m_fNewBrightness)
    {
      // switching on
      m_fCurBrightness += tick / c_fSwitchOnTime;
      if (m_fCurBrightness > m_fNewBrightness)
      {
        m_fCurBrightness = m_fNewBrightness;
      }
    }
    else if (m_fCurBrightness > m_fNewBrightness)
    {
      // switching off
      m_fCurBrightness -= tick / c_fSwitchOffTime;
      if (m_fCurBrightness < m_fNewBrightness)
      {
        m_fCurBrightness = m_fNewBrightness;
      }
    }
      
    bEnable = m_fCurBrightness > 0;
    
    m_aLight.setEnabled(bEnable);
    
    if (bEnable)
    {
      m_aLight.setColor(m_fCurBrightness * m_aOrgColor.x, m_fCurBrightness * m_aOrgColor.y, m_fCurBrightness * m_aOrgColor.z);
    }
    
    // This controls the fading between normal object color and completely white, using a special material (fade_to_white)
    m_aEntCol.w = m_fCurBrightness;
    m_aSCO.setEntityColor(m_aEntCol);
}public void onNextFrame(float tick)
{
    m_aLight.setEnabled(true);
}public void onNextFrame(float tick)
{
    bool bEnable = sim.getCurSunElevation() <= m_fElevationLimit;
    if (bEnable != m_bEnabled)
    {
      if (bEnable)
      {
        // switching on
        m_fCurBrightness = c_fStartBrightness;
        m_fNewBrightness = 1.0f;
        m_bEnabled = true;
      }
      else
      {
        // switching off
        m_fNewBrightness = 0.0f;
        m_bEnabled = false;
      }
    } 
    
    if (m_fCurBrightness < m_fNewBrightness)
    {
      // switching on
      m_fCurBrightness += tick / c_fSwitchOnTime;
      if (m_fCurBrightness > m_fNewBrightness)
      {
        m_fCurBrightness = m_fNewBrightness;
      }
    }
    else if (m_fCurBrightness > m_fNewBrightness)
    {
      // switching off
      m_fCurBrightness -= tick / c_fSwitchOffTime;
      if (m_fCurBrightness < m_fNewBrightness)
      {
        m_fCurBrightness = m_fNewBrightness;
      }
    }
      
    bEnable = m_fCurBrightness > 0;
    
    m_aLight.setEnabled(bEnable);
    
    if (bEnable)
    {
      m_aLight.setColor(m_fCurBrightness * m_aOrgColor.x, m_fCurBrightness * m_aOrgColor.y, m_fCurBrightness * m_aOrgColor.z);
    }
    
    // This controls the fading between normal object color and completely white, using a special material (fade_to_white)
    m_aEntCol.w = m_fCurBrightness;
    m_aSCO.setEntityColor(m_aEntCol);
}public void onNextFrame(float tick)
{
    m_aLight.setEnabled(true);
}