/// <summary> /// Adds a new Action to the list of Actions to be executed every millis. /// </summary> /// <param name="callback"></param> public ObjectUpdateTimer CallPeriodically(int millis, Action <WorldObject> callback) { var action = new ObjectUpdateTimer(millis, callback); AddUpdateAction(action); return(action); }
/// <summary> /// Adds a new Action to the list of Actions to be executed every millis. /// </summary> /// <param name="callback"></param> public ObjectUpdateTimer CallPeriodicallyUntil(int callIntervalMillis, int callUntilMillis, Action <WorldObject> callback) { var action = new ObjectUpdateTimer(callIntervalMillis, callback); AddUpdateAction(action); CallDelayed(callUntilMillis, obj => RemoveUpdateAction(action)); return(action); }
/// <summary> /// Adds a new Action to the list of Actions to be executed every action.Delay milliseconds /// </summary> public void AddUpdateAction(ObjectUpdateTimer timer) { if (m_updateActions == null) { m_updateActions = new List <ObjectUpdateTimer>(3); } timer.LastCallTime = m_lastUpdateTime; m_updateActions.Add(timer); }
/// <summary> /// Removes the given Action /// </summary> /// <param name="timer"></param> public bool RemoveUpdateAction(ObjectUpdateTimer timer) { if (m_updateActions != null) { if (m_updateActions.Remove(timer)) { return(true); } } return(false); }
/// <summary> /// Removes the given Action /// </summary> /// <param name="timer"></param> public bool RemoveUpdateAction(ObjectUpdateTimer timer) { if (m_updateActions != null) { if (m_updateActions.Remove(timer)) { return true; } } return false; }
/// <summary> /// Adds a new Action to the list of Actions to be executed every action.Delay milliseconds /// </summary> public void AddUpdateAction(ObjectUpdateTimer timer) { if (m_updateActions == null) { m_updateActions = new List<ObjectUpdateTimer>(3); } timer.LastCallTime = m_lastUpdateTime; m_updateActions.Add(timer); }
/// <summary> /// Adds a new Action to the list of Actions to be executed every millis. /// </summary> /// <param name="callback"></param> public ObjectUpdateTimer CallPeriodicallyUntil(int callIntervalMillis, int callUntilMillis, Action<WorldObject> callback) { var action = new ObjectUpdateTimer(callIntervalMillis, callback); AddUpdateAction(action); CallDelayed(callUntilMillis, obj => RemoveUpdateAction(action)); return action; }
/// <summary> /// Adds a new Action to the list of Actions to be executed every millis. /// </summary> /// <param name="callback"></param> public ObjectUpdateTimer CallPeriodically(int millis, Action<WorldObject> callback) { var action = new ObjectUpdateTimer(millis, callback); AddUpdateAction(action); return action; }
public override void Start() { decreptifyTimer = m_owner.CallPeriodically(Utility.Random(5000, 10000), CastDecrepify); base.Start(); }