CCAction -> { CCFiniteTimeAction, CCFollow, CCSpeed}
CCFiniteTimeAction -> { CCActionInstant, CCActionInterval }
CCActionInstant -> { CCCallFunc, CCFlipX, CCFlipY, CCHide, CCPlace, CCReuseGrid, CCShow, CCStopGrid, CCToggleVisibility }
CCActionInterval -> { CCAccelAmplitude, CCActionCamera, CCActionEase, CCAnimate, CCBezierBy, CCBlink, CCDelayTime, CCFadeIn, CCFadeOut, CCFadeTo, CCGridAction, CCJumpBy, CCMoveTo, CCProgressFromTo, CCProgressTo, CCRepeat, CCRepeatForever, CCReverseTime, CCRotateBy, CCRotateTo, CCScaleTo, CCSequence, CCSkewTo, CCSpawn, CCTintBy, CCTintTo}
Action的用法:
1. 创建CCAction实例,通常每个CCAction的派生类都提供一个或多个静态方法来创建实例。如:
CCAnimation *animation = CCAnimation::animationWithFrames(animFrames, 0.2f);
CCAnimate *animate = CCAnimate::actionWithAnimation(animation, false);
2. 通过CCSprite实例调用CCSprite::runAction( pAction)。如:
sprite->runAction(CCRepeatForever::actionWithAction( animate ) );
实际上,CCSprite是继承了CCNode类的,调用的是CCNode::runAction(...),在这里面只是简单的把action和this指针注册到CCActionManager里面了:
CCAction * CCNode::runAction(CCAction* action)
{
CCAssert( action != NULL, "Argument must be non-nil");
CCActionManager::sharedManager()->addAction(action, this, !m_bIsRunning);
return action;
}
而CCActionManager::addAction(action, pNode, bPaused)则把action保存到队列里,然后在CCActionManager::update()里调用CCAction::step(), CCAction::isDone(), CCAction::stop()等,如果检测到action已经结束,则调用CCActionManager::removeAction(...)移除action。
而CCAction::update()则是某些派生类在step()内部调用的,