Cocostudio::ActionObject修正

3.2版本没有处理_bPlaying状态,导致isPlaying()方法无效,具体如下,红色是我添加的代码。另外该类没有处理pause状态,且没有resume相关处理,望尽快完善。

void ActionObject::play()
{
stop();
_bPlaying = true;
this->updateToFrameByTime(0.0f);
for(const auto &e : _actionNodeList)
{
e->playAction();
}
if (_loop)
{
_pScheduler->schedule(schedule_selector(ActionObject::simulationActionUpdate), this, 0.0f , kRepeatForever, 0.0f, false);
}
else
{
_pScheduler->schedule(schedule_selector(ActionObject::simulationActionUpdate), this, 0.0f, false);
}
}

void ActionObject::stop()
{
for(const auto &e : _actionNodeList)
{
e->stopAction();
}
_pScheduler->unschedule(schedule_selector(ActionObject::simulationActionUpdate), this);
_bPause = false;
_bPlaying = false;

}

void ActionObject::simulationActionUpdate(float dt)
{
bool isEnd = true;

for(const auto &e : _actionNodeList)

{
if (!e->isActionDoneOnce())
{
isEnd = false;
break;
}
}

if (isEnd)
{
if (_CallBack != nullptr)
{
_CallBack->execute();
}
if (_loop)
{
this->play();
}
else
{
_pScheduler->unschedule(schedule_selector(ActionObject::simulationActionUpdate), this);
_bPlaying = false;
}
}

}