-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
I have a need for a selector that iterates over each child regardless that it passed or fails, it will still wait if the Task returns RUNNING however.
Its basically just a modified version of the SequenceSelector, not sure if this is the best way to do this or not:
public class IterateSelector extends SequenceSelector
{
override protected function updateTask (dt :Number) :int {
while (_childIdx < _children.length) {
_curChild = _children[_childIdx];
var childStatus :int = _curChild.update(dt);
if (childStatus == SUCCESS || childStatus==FAIL) {
// the child completed. Move on to the next.
_curChild = null;
_childIdx++;
} else {
// RUNNING return immediately
return childStatus;
}
}
// all our children have completed successfully
return SUCCESS;
}
}
Metadata
Metadata
Assignees
Labels
No labels