CallFunc 不会在延迟后被调用

CallFunc doesn’t get called after delay

我在节点子类中有两个函数,它们用动作做一些动画。当一个 运行ning 调用另一个函数时,我想确保它得到妥善处理。所以我做了一个测试:

Monster * node = Monster::create();
addChild(node);

auto sequence1 = Sequence::create(CallFunc::create(std::bind(&Monster:: animateWalk, node)),
                                  DelayTime::create(2.0),
                                  NULL);
// wait 2 seconds, then call this function
auto sequence2 = Sequence::create(DelayTime::create(2.0),
                                  CallFunc::create(std::bind(&Monster::animateBite, node)),
                                  NULL);

auto repeat1 = RepeatForever::create(sequence1);
auto repeat2 = RepeatForever::create(sequence2);
node->runAction(repeat1);
node->runAction(repeat2);

调用了第一个函数 (animateWalk),但从未调用过第二个函数 (animateBite)。如果我注释掉 repeat1 的第一个 运行Action,那么第二个序列会执行 运行。我如何 运行 延迟后的第二个函数,而第一个函数是 运行ning?

 Monster * node = Monster::create();
addChild(node);

auto sequence1 = Sequence::create(CallFunc::create(std::bind(&Monster::   animateWalk, node)),
                              DelayTime::create(2.0),
                              NULL);
 // wait 2 seconds, then call this function
 auto sequence2 = Sequence::create(DelayTime::create(2.0),
                              CallFunc::create(std::bind(&Monster::animateBite, node)),
                              NULL);


// You can do something like this 

**auto FinalSeq = Sequence::create(sequence1,DelayTime::create(2.0),sequence2);

auto FinalAction = RepeatForever::create(FinalSeq);

node->runAction(FinalAction);**