Exemple #1
0
void CDeathmatchObject::StartMovement ( const CPositionRotationAnimation& a_rMoveAnimation )
{
    if ( m_pMoveAnimation != NULL )
    {
        _StopMovement ( true );
    }

    if ( a_rMoveAnimation.IsRunning () )
    {
        // Add us to the moving object's manager
        m_pMovingObjectsManager->Add ( this );
        m_pMoveAnimation = new CPositionRotationAnimation ( a_rMoveAnimation );
    }
    else
    {
        SPositionRotation positionRotation;
        a_rMoveAnimation.GetFinalValue ( positionRotation );
        SetOrientation ( positionRotation.m_vecPosition, positionRotation.m_vecRotation );
    }
}
Exemple #2
0
void CObject::Move ( const CPositionRotationAnimation& a_rMoveAnimation )
{
    // Are we already moving?
    if ( IsMoving () )
    {
        // Stop our current movement
        StopMoving ();
    }

    if (a_rMoveAnimation.IsRunning() )
    {
        m_pMoveAnimation = new CPositionRotationAnimation ( a_rMoveAnimation );
        // Update the values since they might have changed since StopMoving () was called above
        m_pMoveAnimation->SetSourceValue( SPositionRotation ( m_vecPosition, m_vecRotation ) );
    }
    // If we have a time of 0, move there now
    else
    {
        SPositionRotation positionRotation;
        a_rMoveAnimation.GetFinalValue ( positionRotation );
        SetPosition ( positionRotation.m_vecPosition );
        SetRotation ( positionRotation.m_vecRotation );
    }
}