/// <summary> /// Checks if associated delegate have to be invoked /// and updates this object's state. /// </summary> /// <param name="tick">Current timestamp</param> /// <returns>True if this object has to be removed from events list.</returns> public bool Update(long tick) { if (ToDelete) { return(true); } if (_nextExecute == 0) { _nextExecute = tick + Interval; } if (_nextExecute <= tick) { if (BaseCount > 0) { --Count; } Del?.Invoke(); if (UserData != null) { DelEx?.Invoke(UserData); } _nextExecute = tick + Interval; } if (Count <= 0 && BaseCount != 0) { ToDelete = true; } return(ToDelete); }