コード例 #1
0
ファイル: TimerMgr.cs プロジェクト: yellowshq/myGameFramework
        // Update is called once per frame
        void Update()
        {
            for (int i = EventLists.Count - 1; i >= 0; --i)
            {
                tmpEvent = EventLists[i];
                try
                {
                    if (tmpEvent.IsCanRemoveEvent())
                    {
                        tmpEvent.IsFinish = true;
                    }
                }
                catch (Exception exp)
                {
                    Debug.LogException(exp);
                    tmpEvent.IsFinish = true;
                }
            }

            for (int i = EventLists.Count - 1; i >= 0; --i)
            {
                tmpEvent = EventLists[i];
                if (tmpEvent.IsFinish)
                {
                    try
                    {
                        if (tmpEvent.OnFinish != null)
                        {
                            tmpEvent.OnFinish();
                        }
                    }
                    catch (Exception exp)
                    {
                        Debug.LogException(exp);
                    }
                    finally
                    {
                        EventLists.Remove(tmpEvent);
                    }
                }
            }
        }