Example #1
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// 运行事件
        /// </summary>
        /// <param name=""></param>
        /// <returns></returns>
        /// -----------------------------------------------------------------------------
        public void Run()
        {
            if (m_Break)
            {
                return;
            }

            if (this.TimeLeft > 0.0f)
            {
                return;
            }

            if (this.m_TimerEvent != null)
            {
                this.m_TimerEvent();
            }

            if (this.m_TimerArgsEvent != null)
            {
                this.m_TimerArgsEvent(m_Args);
            }

            if (m_Mode == TIMER_MODE.NORMAL)
            {
                m_Manger.Destroy(this.m_Name);
            }
            else
            {
                m_StartTime     = Time.time;
                m_BreakDuration = 0;

                if (Times > 0)
                {
                    m_CurrentTimes++;
                    if (m_CurrentTimes >= Times)
                    {
                        m_Manger.Destroy(this.m_Name);
                        m_CurrentTimes = 0;
                    }
                }
            }
            return;
        }