예제 #1
0
void FlyingVehicle::advanceTime(F32 dt)
{
   Parent::advanceTime(dt);

   updateEngineSound(1);
   updateJet(dt);
}
예제 #2
0
//--------------------------------------------------------------------------
void HoverVehicle::advanceTime(F32 dt)
{
    Parent::advanceTime(dt);

    // Update jetsound...
    if ( mJetSound )
    {
        if ( mJetting )
        {
            if ( !mJetSound->isPlaying() )
                mJetSound->play();

            mJetSound->setTransform( getTransform() );
        }
        else
            mJetSound->stop();
    }

    // Update engine sound...
    if ( mEngineSound )
    {
        if ( !mEngineSound->isPlaying() )
            mEngineSound->play();

        mEngineSound->setTransform( getTransform() );

        F32 denom  = mDataBlock->mainThrustForce + mDataBlock->strafeThrustForce;
        F32 factor = getMin(mThrustLevel, denom) / denom;
        F32 vol = 0.25 + factor * 0.75;
        mEngineSound->setVolume( vol );
    }

    // Are we floating?  If so, start the floating sound...
    if ( mFloatSound )
    {
        if ( mFloating )
        {
            if ( !mFloatSound->isPlaying() )
                mFloatSound->play();

            mFloatSound->setTransform( getTransform() );
        }
        else
            mFloatSound->stop();
    }

    updateJet(dt);
    updateDustTrail( dt );
}