/// <summary> /// 获取轮询实例 /// </summary> /// <returns></returns> public TimeAction GetTimeAction() { TimeAction m_TimeAction = CreateTimeAction(); m_TimeAction.Reset(); m_TimeAction.InitTimeAction(); return(m_TimeAction); }
/// <summary> /// 创建定时器 /// </summary> /// <returns></returns> public TimeAction CreateTimeAction() { TimeAction timeAction = null; TimeActionObject timeActionObject = m_TimeActionObjectPool.Spawn(); if (timeActionObject != null) { timeAction = (TimeAction)timeActionObject.Target; } else { timeAction = new TimeAction(); TimeActionObject actionObject = new TimeActionObject(); actionObject.Initialize(timeAction); m_TimeActionObjectPool.Register(actionObject, true); } timeAction.Reset(); return(timeAction); }
/// <summary> /// 移除定时器 /// </summary> /// <param name="action"></param> public void RemoveTimeAction(TimeAction action) { action.Reset(); m_TimeActionList.Remove(action); m_TimeActionObjectPool.Unspawn(action); }
/// <summary> /// 注册定时器 /// </summary> /// <param name="action"></param> public void RegisterTimeAction(TimeAction action) { m_TimeActionList.AddLast(action); }