当前位置: 首页>>代码示例>>C++>>正文


C++ CClientPed::IsFrozen方法代码示例

本文整理汇总了C++中CClientPed::IsFrozen方法的典型用法代码示例。如果您正苦于以下问题:C++ CClientPed::IsFrozen方法的具体用法?C++ CClientPed::IsFrozen怎么用?C++ CClientPed::IsFrozen使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CClientPed的用法示例。


在下文中一共展示了CClientPed::IsFrozen方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: UpdateContacting

//
// Apply object movement to contacting peds
//
void CDeathmatchObject::UpdateContacting(const CVector& vecCenterOfRotation, const CVector& vecFrameTranslation, const CVector& vecFrameRotation)
{
    bool bHasRotation = (vecFrameRotation.fX != 0 || vecFrameRotation.fY != 0 || vecFrameRotation.fZ != 0);
    bool bHasTranslation = (vecFrameTranslation.fX != 0 || vecFrameTranslation.fY != 0 || vecFrameTranslation.fZ != 0);

    // Early out if no orientation change here
    if (!bHasRotation && !bHasTranslation)
        return;

    // Step through each contacting ped
    list<CClientPed*>::iterator iter = m_Contacts.begin();
    for (; iter != m_Contacts.end(); ++iter)
    {
        CClientPed* pPed = *iter;

        // Do not move the ped if it is frozen
        if (pPed->IsFrozen())
            continue;

        // Get ped start position
        CVector vecPlayerPosition;
        pPed->GetPosition(vecPlayerPosition);

        // Apply rotation effect on position
        if (bHasRotation)
        {
            vecPlayerPosition -= vecCenterOfRotation;
            RotateVector(vecPlayerPosition, CVector(-vecFrameRotation.fX, -vecFrameRotation.fY, -vecFrameRotation.fZ));
            vecPlayerPosition += vecCenterOfRotation;
        }

        // Apply translation
        vecPlayerPosition += vecFrameTranslation;
        pPed->SetPosition(vecPlayerPosition);

        // Also change ped facing direction
        if (vecFrameRotation.fZ != 0)
        {
            float fRotationZ = pPed->GetCurrentRotation();
            pPed->SetCurrentRotation(fRotationZ + vecFrameRotation.fZ);
        }
    }

    // Look in attached objects for more ped contacts
    for (uint i = 0; i < m_AttachedEntities.size(); ++i)
    {
        CClientEntity* pEntity = m_AttachedEntities[i];
        if (IS_OBJECT(pEntity))
        {
            CDeathmatchObject* pObject = static_cast<CDeathmatchObject*>(pEntity);
            pObject->UpdateContacting(vecCenterOfRotation, vecFrameTranslation, vecFrameRotation);
        }
    }
}
开发者ID:Necktrox,项目名称:mtasa-blue,代码行数:57,代码来源:CDeathmatchObject.cpp


注:本文中的CClientPed::IsFrozen方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。