public void update(float dt) { if (!_targets.Any()) { return; } var enumerator = new Dictionary <int, tHashElement>(_targets).GetEnumerator(); while (enumerator.MoveNext()) { var elt = enumerator.Current.Value; _currentTarget = elt; _currentTargetSavlvaged = false; if (elt.target != null && elt.actions != null && !elt.paused) { for (elt.actionIndex = 0; elt.actions != null && elt.actionIndex < elt.actions.Count; elt.actionIndex++) { elt.currentAction = elt.actions[elt.actionIndex]; elt.currentActionSalvaged = false; elt.currentAction.step(dt); if (!elt.currentActionSalvaged && elt.currentAction != null && elt.currentAction.isDone()) { elt.currentAction.stop(); CCAction a = elt.currentAction; elt.currentAction = null; removeAction(a); } elt.currentAction = null; } } if (_currentTargetSavlvaged && (elt.actions.Count == 0 || elt.target == null)) { deleteHashElement(elt); } } _currentTarget = null; }
//-------------update------------ /** 'update' the scheduler. * You should NEVER call this method, unless you know what you are doing. */ public void update(float dt) { if (_paused) { return; } updateHashLocked = true; if (!FloatUtils.EQ(_timeScale, 1.0f)) { dt *= _timeScale; } // Iterate all over the Updates selectors // updates with priority < 0 { for (utNode <tListEntry> tmp = updatesNeg.head; tmp != null; tmp = tmp.next) { utNode <tListEntry> entry = tmp; if (!entry.obj.paused && !entry.obj.markedForDeletion) { entry.obj.impMethod.Invoke(dt); } } } // updates with priority == 0 { for (utNode <tListEntry> tmp = updates0.head; tmp != null; tmp = tmp.next) { utNode <tListEntry> entry = tmp; if (!entry.obj.paused && !entry.obj.markedForDeletion) { entry.obj.impMethod.Invoke(dt); } } } // updates with priority > 0 { for (utNode <tListEntry> tmp = updatesPos.head; tmp != null; tmp = tmp.next) { utNode <tListEntry> entry = tmp; if (!entry.obj.paused && !entry.obj.markedForDeletion) { entry.obj.impMethod.Invoke(dt); } } } // Iterate all over the custom selectors (CCTimers) if (hashForTimers.Any()) { var enumerator = new Dictionary <int, tHashTimerEntry>(hashForTimers).GetEnumerator(); while (enumerator.MoveNext()) { var elt = enumerator.Current.Value; currentTarget = elt; currentTargetSalvaged = false; if (!currentTarget.paused) { for (elt.timerIndex = 0; elt.timerIndex < elt.timers.Count; elt.timerIndex++) { elt.currentTimer = elt.timers[elt.timerIndex]; elt.currentTimerSalvaged = false; elt.currentTimer.update(dt); elt.currentTimer = null; } } if (currentTargetSalvaged && currentTarget.timers.Count == 0) { removeHashElement(currentTarget); } } } for (utNode <tListEntry> tmp = updatesNeg.head; tmp != null; tmp = tmp.next) { utNode <tListEntry> entry = tmp; if (entry.obj.markedForDeletion) { removeUpdatesFromHash(entry); } } for (utNode <tListEntry> tmp = updates0.head; tmp != null; tmp = tmp.next) { utNode <tListEntry> entry = tmp; if (entry.obj.markedForDeletion) { removeUpdatesFromHash(entry); } } for (utNode <tListEntry> tmp = updatesPos.head; tmp != null; tmp = tmp.next) { utNode <tListEntry> entry = tmp; if (entry.obj.markedForDeletion) { removeUpdatesFromHash(entry); } } updateHashLocked = false; currentTarget = null; }