Gems/EMotionFX/Code/EMotionFX/Source/MotionQueue.cpp
// find out if we should start playing the next motion in the queue or not
find out if we should start playing the next motion in the queue or not
find out if we should start playing the next motion in the queue or not
bool MotionQueue::ShouldPlayNextMotion()
    {
        MotionInstance* motionInst = m_motionSystem->FindFirstNonMixingMotionInstance();
        if (motionInst == nullptr)
        {
            return false;
        }
        const float timeToRemoveFromMaxTime = GetFirstEntry().m_playInfo.m_blendInTime + motionInst->GetFadeTime();
        if (motionInst->GetIsStopping() || motionInst->GetHasEnded())
        {
            return true;
        }
        else
        {
            if (motionInst->GetMaxPlayTime() > 0.0f)
            {
                if (motionInst->GetCurrentTime() >= motionInst->GetMaxPlayTime() - timeToRemoveFromMaxTime)
                {
                    return true;
                }
            }
            if (motionInst->GetMaxLoops() != EMFX_LOOPFOREVER)
            {
                if (motionInst->GetMaxLoops() - 1 == motionInst->GetNumCurrentLoops())
                {
                    if (motionInst->GetCurrentTime() >= motionInst->GetDuration() - timeToRemoveFromMaxTime)
                    {
                        return true;
                    }
                }
            }
        }
        return false;
    }
bool MotionQueue :: ShouldPlayNextMotion ( ) { MotionInstance * motionInst = m_motionSystem -> FindFirstNonMixingMotionInstance ( ) ; if ( motionInst == nullptr ) { return false ; } const float timeToRemoveFromMaxTime = GetFirstEntry ( ) . m_playInfo . m_blendInTime + motionInst -> GetFadeTime ( ) ; if ( motionInst -> GetIsStopping ( ) || motionInst -> GetHasEnded ( ) ) { return true ; } else { if ( motionInst -> GetMaxPlayTime ( ) > 0.0f ) { if ( motionInst -> GetCurrentTime ( ) >= motionInst -> GetMaxPlayTime ( ) - timeToRemoveFromMaxTime ) { return true ; } } if ( motionInst -> GetMaxLoops ( ) != EMFX_LOOPFOREVER ) { if ( motionInst -> GetMaxLoops ( ) - 1 == motionInst -> GetNumCurrentLoops ( ) ) { if ( motionInst -> GetCurrentTime ( ) >= motionInst -> GetDuration ( ) - timeToRemoveFromMaxTime ) { return true ; } } } } return false ; }
find out if we should start playing the next motion in the queue or not
find out if we should start playing the next motion in the queue or not
// find the first non mixing motion // if there isn't a non mixing motion // the total amount of blending time // if the motion has ended or is stopping, then we should start the next motion // if the max playback time is used // if the start of the next motion will have completely faded in, before this motion instance will fade out // if we are not looping forever // if we are in our last loop // if the start of the next motion will have completely faded in, before this motion instance will fade out // shouldn't play the next motion yet