Exemplo n.º 1
0
bool CCInterpolatorSin2Curve::update(const float delta)
{
    updating = false;
    
    if( current != NULL )
    {
        if( incrementAmount( delta ) )
        {
            const float percentage = calculatePercentage();
            updateInterpolation( percentage );
            updating = true;
            return true;
        }
        else if( *current != target )
        {
            *current = target;
            current = NULL;
            updating = true;
            return true;
        }
        else
        {
            current = NULL;
        }
    }
    else if( onInterpolated.length > 0 )
    {
        CCLAMBDA_SIGNAL pendingCallbacks;
        for( int i=0; i<onInterpolated.length; ++i )
        {
            pendingCallbacks.add( onInterpolated.list[i] );
        }
        onInterpolated.length = 0;
        CCLAMBDA_EMIT_ONCE( pendingCallbacks );
    }

    return updating;
}
Exemplo n.º 2
0
void Item::idle(GameObject::IdleCallPath path)
{
   if(!isInDatabase())
      return;

   if(mIsMounted)
   {
      if(mMount.isNull() || mMount->hasExploded)
      {
         if(!isGhost())
            dismount();
      }
      else
      {
         mMoveState[RenderState].pos = mMount->getRenderPos();
         mMoveState[ActualState].pos = mMount->getActualPos();
      }
   }
   else
   {
      float time = mCurrentMove.time * 0.001f;
      move(time, ActualState, false);
      if(path == GameObject::ServerIdleMainLoop)
      {
         // Only update if it's actually moving...
         if(mMoveState[ActualState].vel.len() > 0.001f)
            setMaskBits(PositionMask);

         mMoveState[RenderState] = mMoveState[ActualState];
         
      }
      else
         updateInterpolation();
   }
   updateExtent();
}