public override void goTo( float time , bool skipDelay)
{
// handle delay, which is specific to Tweens
if( skipDelay )
{
_elapsedDelay = delay;
}
else
{
_elapsedDelay = Mathf.Min( time, delay );
time -= _elapsedDelay;
}
_delayComplete = _elapsedDelay >= delay;
time = Mathf.Clamp( time, 0f, totalDuration );
// provide an early out for calling goto on the same time multiple times.
if ( time == _totalElapsedTime )
return;
// if we are doing a goTo at the "start" of the timeline, based on the isReversed variable,
// allow the onBegin and onIterationStart callback to fire again.
// we only allow the onIterationStart event callback to fire at the start of the timeline,
// as doing a goTo(x) where x % duration == 0 will trigger the onIterationEnd before we
// go to the start.
if ( ( isReversed && time == totalDuration ) || ( !isReversed && time == 0f ) )
{
_didBegin = false;
_fireIterationStart = true;
}
else
{
_didBegin = true;
_fireIterationStart = false;
}
// since we're doing a goTo, we want to stop this tween from remembering that it iterated.
// this could cause issues if you caused the tween to complete an iteration and then goTo somewhere
// else while still paused.
_didIterateThisFrame = false;
// force a time and completedIterations before we update
_totalElapsedTime = time;
_completedIterations = isReversed ? Mathf.CeilToInt( _totalElapsedTime / duration ) : Mathf.FloorToInt( _totalElapsedTime / duration );
update( 0 );
}