// -(NSSet *) pauseAllRunningActions // { // NSMutableSet* idsWithActions = [NSMutableSet setWithCapacity:50]; // // for(tHashElement *element=targets; element != NULL; element=element->hh.next) { // if( !element->paused ) { // element->paused = YES; // [idsWithActions addObject:element->target]; // } // } // return idsWithActions; // } // // -(void) resumeTargets:(NSSet *)targetsToResume // { // for(id target in targetsToResume) { // [self resumeTarget:target]; // } // } #endregion #region ActionManager - run public void addAction(CCAction action, System.Object target, bool paused) { NSUtils.Assert(action != null, "Argument action must be non-nil"); NSUtils.Assert(target != null, "Argument target must be non-nil"); tHashElement element = _targets.HASH_FIND_INT(target.GetHashCode()); if (element == null) { element = new tHashElement(); element.paused = paused; element.target = target; _targets.HASH_ADD_INT(target.GetHashCode(), element); } actionAllocWithHashElement(element); NSUtils.Assert(!element.actions.Contains(action), "runAction: Action already running"); element.actions.Add(action); action.startWithTarget(target); }
public override void update(float t) { int found = 0; float new_t = 0; CCAction action0 = _actions [0]; CCAction action1 = _actions [1]; if (FloatUtils.Small(t, _split)) { // action[0] found = 0; if (!FloatUtils.EQ(_split, 0)) { new_t = t / _split; } else { new_t = 1; } } else { // action[1] found = 1; if (FloatUtils.EQ(_split, 1)) { new_t = 1; } else { new_t = (t - _split) / (1 - _split); } } if (found == 1) { if (_last == -1) { // action[0] was skipped, execute it. action0.startWithTarget(_target); action0.update(1.0f); action0.stop(); } else if (_last == 0) { // switching to action 1. stop action 0. action0.update(1.0f); action0.stop(); } } else if (found == 0 && _last == 1) { // Reverse mode ? // XXX: Bug. this case doesn't contemplate when _last==-1, found=0 and in "reverse mode" // since it will require a hack to know if an action is on reverse mode or not. // "step" should be overriden, and the "reverseMode" value propagated to inner Sequences. action1.update(0); action1.stop(); } // Last action found and it is done. if (found == _last && _actions[found].isDone()) { return; } // New action. Start it. if (found != _last) { _actions[found].startWithTarget(_target); } _actions[found].update(new_t); _last = found; }