internal void evaluateActions(float dt) { foreach (KeyValuePair <string, DAction> keyValuePair in actions) { DAction action = keyValuePair.Value; action.evaluateWithNode(this, dt); if (action.elapsed > action.duration) { actionsToRemove.Add(keyValuePair.Key); } } if (actionsToRemove.Count > 0) { foreach (string key in actionsToRemove) { actions.Remove(key); } actionsToRemove.Clear(); } for (int i = children.Count - 1; i >= 0; i--) { children[i].evaluateActions(dt); } }
internal override void evaluateWithNode(DNode node, float dt) { elapsed += dt; if (executionCount < count) { float actionElapsed = action.elapsed; action.evaluateWithNode(node, dt); if (actionElapsed + dt > action.duration) { executionCount += 1; if (executionCount < count) { action = action.copy(); //TODO: performance action.runOnNode(node); dt = actionElapsed + dt - action.duration; elapsed -= dt; evaluateWithNode(node, dt); } } } }
internal override void evaluateWithNode(DNode node, float dt) { elapsed += dt; DAction action = enumerator.Current; if (action != null) { float actionElapsed = action.elapsed; action.evaluateWithNode(node, dt); if (actionElapsed + dt > action.duration) { if (enumerator.MoveNext()) { enumerator.Current.runOnNode(node); dt = actionElapsed + dt - action.duration; elapsed -= dt; evaluateWithNode(node, dt); } } } }