Beispiel #1
0
    void Update()
    {
        if (0 < m_fStartDestroyTime)
        {
            if (0 < m_fSmoothDestroyTime)
            {
                if (m_bSmoothHide)
                {
                    float fRate = 1 - ((GetEngineTime() - m_fStartDestroyTime) / m_fSmoothDestroyTime);
                    if (fRate < 0)
                    {
                        fRate = 0;
                    }

                    // Recursively
                    Renderer[] rens = transform.GetComponentsInChildren <Renderer>(true);
                    for (int n = 0; n < rens.Length; n++)
                    {
                        Renderer ren     = rens[n];
                        string   colName = GetMaterialColorName(ren.material);

                        if (colName != null)
                        {
                            Color col = ren.material.GetColor(colName);
                            col.a = Mathf.Min(fRate, col.a);
                            ren.material.SetColor(colName, col);
                        }
                    }
                }
                if (m_fStartDestroyTime + m_fSmoothDestroyTime < GetEngineTime())
                {
                    AutoDestruct();
                }
            }
        }
        else
        {
            // Time
//          if (0 < m_fStartTime && m_fLifeTime != 0)
            if (0 < m_fStartTime)
            {
                if (m_fStartTime + m_fLifeTime <= GetEngineTime())
                {
                    StartDestroy();
                }
            }

            // event
            if (m_bEndNcCurveAnimation && m_NcCurveAnimation != null)
            {
                if (1 <= m_NcCurveAnimation.GetElapsedRate())
                {
                    StartDestroy();
                }
            }
        }
    }