/// <summary> /// Stops all actions and clear all action lists. /// </summary> public void StopAllActions() { ActionsOverTime.ForEach((ActionOverTime item) => item.Stop()); ActionsOverTime.Clear(); ActionsOverTimeToActivate.Clear(); ActionsOverTimeToRemove.Clear(); }
private void ActivateAction() { int size = ActionsOverTimeToActivate.Count; for (int i = size - 1; i >= 0; i--) { ActionsOverTime.Add(ActionsOverTimeToActivate[i]); // Set the target. ActionsOverTimeToActivate[i].Target = this; ActionsOverTimeToActivate[i].Ready(); // Start the action. ActionsOverTimeToActivate[i].Start(); } ActionsOverTimeToActivate.RemoveRange(0, size); }
/// <summary> /// Update /// Dt is disference of time since last call /// </summary> /// <param name="dt">Dt.</param> public virtual void Update(GameTime dt) { if (Updatable) { foreach (ActionOverTime action in ActionsOverTime) { action.Update(dt); } foreach (ActionOverTime action in ActionsOverTimeToRemove) { ActionsOverTime.Remove(action); } ActionsOverTimeToRemove.Clear(); ActivateAction(); OnUpdate(dt); } }
/// <summary> /// Resumes all actions. /// </summary> public void ResumeAllActions() { ActionsOverTime.ForEach((ActionOverTime item) => item.Resume()); }
/// <summary> /// Pauses all actions. /// </summary> public void PauseAllActions() { ActionsOverTime.ForEach((ActionOverTime item) => item.Pause()); }