Пример #1
0
            /// <summary>
            /// 注册
            /// </summary>
            /// <param name="fTrigger"></param>
            /// <param name="handleAction"></param>
            /// <param name="objTrigger"></param>
            public void Register(UInt32 uId, float fCountDownTime, HandleObjectAction handleOnTimeUp, System.Object objTimeUpParam, TUnityTimeType tTimeType, float fStartDelay)
            {
                float fTimeNow = CTimeAlgorithm.GetGameTimeNow(tTimeType);

                m_uTimerId            = uId;
                m_fLifeTimeRemain     = fCountDownTime;
                m_handleTriggerAction = handleOnTimeUp;
                m_objTriggerParam     = objTimeUpParam;
                m_fStartTime          = fTimeNow + fStartDelay;
            }
Пример #2
0
            /// <summary>
            /// 更新
            /// </summary>
            public void TickUpdate()
            {
                float fTimeNow = CTimeAlgorithm.GetGameTimeNow(m_TimeType);

                if (fTimeNow < m_fStartTime || IsTimeUp())
                {
                    return;
                }
                float fDeltaTime = fTimeNow - m_fLastUpdateTime;

                m_fLastUpdateTime  = fTimeNow;
                m_fLifeTimeRemain -= fDeltaTime;

                if (IsTimeUp() == true)
                {
                    OnTimeUp();
                    return;
                }

                UpdateInterval(fDeltaTime);
            }