| 419 | } |
| 420 | |
| 421 | bool Repeat::initWithAction(FiniteTimeAction* action, unsigned int times) |
| 422 | { |
| 423 | if (action && ActionInterval::initWithDuration(action->getDuration() * times)) |
| 424 | { |
| 425 | _times = times; |
| 426 | _innerAction = action; |
| 427 | action->retain(); |
| 428 | |
| 429 | _actionInstant = dynamic_cast<ActionInstant*>(action) ? true : false; |
| 430 | // an instant action needs to be executed one time less in the update method since it uses startWithTarget to |
| 431 | // execute the action |
| 432 | // minggo: instant action doesn't execute action in Repeat::startWithTarget(), so comment it. |
| 433 | // if (_actionInstant) |
| 434 | // { |
| 435 | // _times -=1; |
| 436 | // } |
| 437 | _total = 0; |
| 438 | |
| 439 | return true; |
| 440 | } |
| 441 | |
| 442 | return false; |
| 443 | } |
| 444 | |
| 445 | Repeat* Repeat::clone() const |
| 446 | { |
no test coverage detected