Ejemplo n.º 1
0
 private void Update()
 {
     if (m_CountDownInfoList.Count > 0)
     {
         float deltaTime = Time.deltaTime;
         for (int i = m_CountDownInfoList.Count - 1; i >= 0; i--)
         {
             CountDownInfo item = m_CountDownInfoList[i];
             item.CountDown -= deltaTime;
             if (item.CountDown <= item.NextCountDown)
             {
                 if (item.UpdateNotify != null && !item.IsObsolete)
                 {
                     item.UpdateNotify(item.NextCountDown);
                 }
                 if (item.CountDown <= 0 || item.IsObsolete)
                 {
                     item.UpdateNotify = null;
                     m_CountDownInfoList.RemoveAt(i);
                 }
                 else
                 {
                     item.NextCountDown -= item.NotifyInterval;
                     if (item.NextCountDown < 0)
                     {
                         item.NextCountDown = 0;
                     }
                 }
             }
         }
     }
 }
Ejemplo n.º 2
0
    private void Update()
    {
        if (m_CountDownInfoList.Count > 0)
        {
            float deltaTime = Time.deltaTime;
            for (int i = m_CountDownInfoList.Count - 1; i >= 0; i--)
            {
                CountDownInfo item = m_CountDownInfoList[i];
                item.CountDown -= deltaTime;
                if (item.CountDown <= item.NextCountDown)
                {
                    if (item.UpdateNotify != null && !item.IsObsolete)
                    {
                        item.UpdateNotify(item.NextCountDown);
                    }
                    if (item.CountDown <= 0 || item.IsObsolete)
                    {
                        item.UpdateNotify = null;
                        m_CountDownInfoList.RemoveAt(i);
                    }
                    else
                    {
                        item.NextCountDown -= item.NotifyInterval;
                        if (item.NextCountDown < 0)
                        {
                            item.NextCountDown = 0;
                        }
                    }
                }
            }
        }

        if (Input.GetKeyDown(KeyCode.A))
        {
            Debug.LogFormat("=============手动GC一次==========");
            Utility.CallGC();
        }
    }