/// <summary> /// Process all scheduled activities for the given time. Each activity is /// given one "step", equivalent to one frame of animation. /// </summary> /// <param name="currentTime">The time for which to process each activity.</param> public virtual void ProcessActivities(long currentTime) { int size = activities.Count; if (size > 0) { processingActivities.Clear(); processingActivities.AddRange(activities); for (int i = size - 1; i >= 0; i--) { PActivity each = processingActivities[i]; each.ProcessStep(currentTime); } } }
/// <summary> /// Process all scheduled activities for the given time. Each activity is /// given one "step", equivalent to one frame of animation. /// </summary> /// <param name="currentTime">The time for which to process each activity.</param> public virtual void ProcessActivities(long currentTime) { // In some cases, starting another timer or setting its interval can // cause ProcessActivities to get re-called. So, we need to catch re-entrances here. if (processActivitiesRecur > 0) { return; } processActivitiesRecur++; int size = activities.Count; if (size > 0) { processingActivities.Clear(); processingActivities.AddRange(activities); for (int i = size - 1; i >= 0; i--) { PActivity each = processingActivities[i]; each.ProcessStep(currentTime); } } processActivitiesRecur--; }
/// <summary> /// Removes all activities currently scheduled to run. /// </summary> /// <remarks>This method clears the scheduler.</remarks> public virtual void RemoveAllActivities() { activitiesChanged = true; activities.Clear(); StopActivityTimer(); }