Beispiel #1
0
bool ParallelAnim::step()
{
    assert(isRunning());
    vector<AnimPtr>::iterator it;
    for (it=m_RunningAnims.begin(); it != m_RunningAnims.end(); ) {
        AnimPtr pAnim = (*it);
        bool bDone;
        if (pAnim->isRunning()) {
            bDone = pAnim->step();
        } else {
            bDone = true;
        }
        if (bDone) {
            it = m_RunningAnims.erase(it);
        } else {
            ++it;
        }
    }
    if (m_RunningAnims.empty()) {
        setStopped();
        ParallelAnimPtr tempThis = m_This;
        m_This = ParallelAnimPtr();
        tempThis = ParallelAnimPtr();
        return true;
    }
    if (m_MaxAge != -1 && Player::get()->getFrameTime()-m_StartTime >= m_MaxAge) {
        abort();
        return true;
    }
    return false;
}
Beispiel #2
0
bool StateAnim::step()
{
    // Make sure the object isn't deleted until the end of the method.
    AnimPtr tempThis = shared_from_this();  

    if (!m_sCurStateName.empty()) {
        const AnimState& curState = m_States[m_sCurStateName];
        AnimPtr pAnim = curState.m_pAnim;
        bool bDone;
        if (pAnim->isRunning()) {
            bDone = curState.m_pAnim->step();
        } else {
            // Special case: AttrAnim stopped because other animation hijacked it.
            bDone = true;
        }
        if (bDone) {
            switchToNewState(curState.m_sNextName, false);
        }
    }
    return false;
}