CCSequence* CCSequence::create(CCArray* arrayOfActions) { CCSequence* pRet = NULL; do { unsigned int count = arrayOfActions->count(); CC_BREAK_IF(count == 0); CCFiniteTimeAction* prev = (CCFiniteTimeAction*)arrayOfActions->objectAtIndex(0); if (count > 1) { for (unsigned int i = 1; i < count; ++i) { prev = createWithTwoActions(prev, (CCFiniteTimeAction*)arrayOfActions->objectAtIndex(i)); } } else { // If only one action is added to CCSequence, make up a CCSequence by adding a simplest finite time action. prev = createWithTwoActions(prev, ExtraAction::create()); } pRet = (CCSequence*)prev; }while (0); return pRet; }
CCSpawn* CCSpawn::createWithVariableList(CCFiniteTimeAction *pAction1, va_list args) { CCFiniteTimeAction *pNow; CCFiniteTimeAction *pPrev = pAction1; bool bOneAction = true; while (pAction1) { pNow = va_arg(args, CCFiniteTimeAction*); if (pNow) { pPrev = createWithTwoActions(pPrev, pNow); bOneAction = false; } else { // If only one action is added to CCSpawn, make up a CCSpawn by adding a simplest finite time action. if (bOneAction) { pPrev = createWithTwoActions(pPrev, ExtraAction::create()); } break; } } return ((CCSpawn*)pPrev); }
Spawn* Spawn::create(Array *arrayOfActions) { Spawn* pRet = NULL; do { unsigned int count = arrayOfActions->count(); CC_BREAK_IF(count == 0); FiniteTimeAction* prev = static_cast<FiniteTimeAction*>(arrayOfActions->getObjectAtIndex(0)); if (count > 1) { for (int i = 1; i < arrayOfActions->count(); ++i) { prev = createWithTwoActions(prev, static_cast<FiniteTimeAction*>(arrayOfActions->getObjectAtIndex(i))); } } else { // If only one action is added to Spawn, make up a Spawn by adding a simplest finite time action. prev = createWithTwoActions(prev, ExtraAction::create()); } pRet = (Spawn*)prev; }while (0); return pRet; }
Sequence* Sequence::createWithVariableList(FiniteTimeAction *pAction1, va_list args) { FiniteTimeAction *pNow; FiniteTimeAction *pPrev = pAction1; bool bOneAction = true; while (pAction1) { pNow = va_arg(args, FiniteTimeAction*); if (pNow) { pPrev = createWithTwoActions(pPrev, pNow); bOneAction = false; } else { // If only one action is added to Sequence, make up a Sequence by adding a simplest finite time action. if (bOneAction) { pPrev = createWithTwoActions(pPrev, ExtraAction::create()); } break; } } return ((Sequence*)pPrev); }
Spawn *Spawn::create(const std::vector<FiniteTimeAction *> &arrayOfActions) { Spawn *ret = nullptr; do { auto count = arrayOfActions.size(); if (count == 0) { break; } auto prev = arrayOfActions.at(0); if (count > 1) { for (int i = 1; i < arrayOfActions.size(); ++i) { prev = createWithTwoActions(prev, arrayOfActions.at(i)); } } else { // If only one action is added to Spawn, make up a Spawn by adding a simplest finite time action. prev = createWithTwoActions(prev, ExtraAction::create()); } ret = static_cast<Spawn *>(prev); } while (0); return ret; }
CCFiniteTimeAction* CCSpawn::create(CCArray *actions) { CCFiniteTimeAction* prev = (CCFiniteTimeAction*)actions->objectAtIndex(0); for (unsigned int i = 1; i < actions->count(); ++i) { prev = createWithTwoActions(prev, (CCFiniteTimeAction*)actions->objectAtIndex(i)); } return prev; }
CCSequence* CCSequence::actionsWithArrayLua(CCArray *actions) { if (actions->count() >= 2) { CCFiniteTimeAction* prev = (CCFiniteTimeAction*)actions->objectAtIndex(0); for (unsigned int i = 1; i < actions->count(); ++i) { prev = createWithTwoActions(prev, (CCFiniteTimeAction*)actions->objectAtIndex(i)); } return (CCSequence*)prev; } return NULL; }
Spawn *Spawn::createWithVariableList(FiniteTimeAction *action1, va_list args) { FiniteTimeAction *now; FiniteTimeAction *prev = action1; bool oneAction = true; while (action1) { now = va_arg(args, FiniteTimeAction *); if (now) { prev = createWithTwoActions(prev, now); oneAction = false; } else { // If only one action is added to Spawn, make up a Spawn by adding a simplest finite time action. if (oneAction) { prev = createWithTwoActions(prev, ExtraAction::create()); } break; } } return ((Spawn *)prev); }
// // Spawn // CCFiniteTimeAction* CCSpawn::create(CCFiniteTimeAction *pAction1, ...) { va_list params; va_start(params, pAction1); CCFiniteTimeAction *pNow; CCFiniteTimeAction *pPrev = pAction1; while (pAction1) { pNow = va_arg(params, CCFiniteTimeAction*); if (pNow) { pPrev = createWithTwoActions(pPrev, pNow); } else { break; } } va_end(params); return pPrev; }