/// <summary> /// 添加一个Timer /// </summary> /// <param name="spaceTime">间隔时间</param> /// <param name="isIgnoreTimeScale">是否忽略时间缩放</param> /// <param name="callBackCount">重复调用的次数</param> /// <param name="timerName">Timer的名字</param> /// <param name="callBack">回调函数</param> /// <param name="objs">回调函数的参数</param> /// <returns></returns> public static TimerEvent AddTimer(float spaceTime, bool isIgnoreTimeScale, int callBackCount, string timerName, TimerCallBack callBack, params object[] objs) { TimerEvent te = new TimerEvent(); te.m_timerName = timerName ?? te.GetHashCode().ToString(); te.m_currentTimer = 0; te.m_timerSpace = spaceTime; te.m_callBack = callBack; te.m_objs = objs; te.m_isIgnoreTimeScale = isIgnoreTimeScale; te.m_repeatCount = callBackCount; m_timers.Add(te); return(te); }
/// <summary> /// 添加一个Timer /// </summary> /// <param name="spaceTime">间隔时间</param> /// <param name="isIgnoreTimeScale">是否忽略时间缩放</param> /// <param name="callBackCount">重复调用的次数</param> /// <param name="timerName">Timer的名字</param> /// <param name="callBack">回调函数</param> /// <param name="objs">回调函数的参数</param> /// <returns></returns> public static TimerEvent AddTimer(float spaceTime, bool isIgnoreTimeScale, int callBackCount, string timerName, TimerCallBack callBack, params object[] objs) { //TimerEvent te = HeapObjectPool<TimerEvent>.GetObject(); TimerEvent te = new TimerEvent(); te.m_timerName = timerName ?? te.GetHashCode().ToString(); //Debug.Log("AddTimer ----TIMER " + " " + te.m_timerName); te.m_currentTimer = 0; te.m_timerSpace = spaceTime; te.m_callBack = callBack; te.m_objs = objs; te.m_isIgnoreTimeScale = isIgnoreTimeScale; te.m_repeatCount = callBackCount; m_timers.Add(te); return(te); }