public override void update (float t)
{
// if t==1, ignore. Animation should finish with t==1
if( FloatUtils.Small( t , 1.0f) ) {
t *= _animation.loops;
// new loop? If so, reset frame counter
uint loopNumber = (uint)t;
if( loopNumber > _executedLoops ) {
_nextFrame = 0;
_executedLoops++;
}
// new t for animations
t = (t % 1.0f);
}
List<CCAnimationFrame> frames = _animation.frames;
uint numberOfFrames = (uint)frames.Count;
CCSpriteFrame frameToDisplay = null;
for( int i=_nextFrame; i < numberOfFrames; i++ ) {
float splitTime = _splitTimes[i];
if(FloatUtils.ES( splitTime , t ) ) {
CCAnimationFrame frame = frames[i];
frameToDisplay = frame.spriteFrame;
((CCSprite)_target).displayedFrame = frameToDisplay;
NSDictionary dict = frame.userInfo;
if( dict != null)
// NSNotificationCenter.defaultCenter.postNotification(CCAnimationFrameDisplayedNotification, _target, dict);
_nextFrame = i+1;
}
// Issue 1438. Could be more than one frame per tick, due to low frame rate or frame delta < 1/FPS
else
break;
}
}