本文整理汇总了C++中CEntity::GetPhysicalProxy方法的典型用法代码示例。如果您正苦于以下问题:C++ CEntity::GetPhysicalProxy方法的具体用法?C++ CEntity::GetPhysicalProxy怎么用?C++ CEntity::GetPhysicalProxy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CEntity
的用法示例。
在下文中一共展示了CEntity::GetPhysicalProxy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
CEntityLayer::~CEntityLayer()
{
for (TEntityProps::iterator it = m_entities.begin(); it != m_entities.end(); ++it)
{
CEntity* pEntity = (CEntity*) (g_pIEntitySystem->GetEntityFromID(it->first));
if (!pEntity)
continue;
if (it->second.m_bIsNoAwake && pEntity->GetPhysicalProxy() && pEntity->GetPhysicalProxy()->GetPhysicalEntity())
{
pe_action_awake aa;
aa.bAwake = false;
pEntity->GetPhysicalProxy()->GetPhysicalEntity()->Action(&aa);
}
it->second.m_bIsNoAwake = false;
}
if (m_pHeap)
m_pGarbageHeaps->push_back(SEntityLayerGarbage(m_pHeap, m_name));
}
示例2: EnableEntities
void CEntityLayer::EnableEntities( bool isEnable )
{
if (m_isEnabled != isEnable)
{
m_isEnabled = isEnable;
if (isEnable)
{
if (gEnv->pRenderer)
{
gEnv->pRenderer->ActivateLayer(m_name.c_str(), isEnable); // Want flash instances on materials activated before entities
}
}
// activate static lights but not brushes
gEnv->p3DEngine->ActivateObjectsLayer(m_id, isEnable, m_havePhysics, false, true, m_name.c_str(), m_pHeap);
pe_action_awake noAwake;
noAwake.bAwake = false;
for (TEntityProps::iterator it = m_entities.begin(); it != m_entities.end(); ++it)
{
EntityProp &prop = it->second;
CEntity* pEntity = (CEntity*) (g_pIEntitySystem->GetEntityFromID(prop.m_id));
if (!pEntity)
continue;
// when is serializing (reading, as we never call this on writing), we dont want to change those values. we just use the values that come directly from serialization.
if (!isEnable && !gEnv->pSystem->IsSerializingFile())
{
prop.m_bIsHidden = pEntity->IsHidden();
prop.m_bIsActive = pEntity->IsActive();
}
if (prop.m_bIsHidden)
continue;
if (isEnable)
{
pEntity->Hide(!isEnable);
pEntity->Activate(prop.m_bIsActive);
if (prop.m_bIsNoAwake && pEntity->GetPhysicalProxy() && pEntity->GetPhysicalProxy()->GetPhysicalEntity())
pEntity->GetPhysicalProxy()->GetPhysicalEntity()->Action(&noAwake);
prop.m_bIsNoAwake = false;
SEntityEvent event;
event.nParam[0] = 1;
static IEntityClass* pConstraintClass = g_pIEntitySystem->GetClassRegistry()->FindClass("Constraint");
if (pConstraintClass && pEntity->GetClass() == pConstraintClass)
{
event.event = ENTITY_EVENT_RESET;
pEntity->SendEvent(event);
event.event = ENTITY_EVENT_LEVEL_LOADED;
pEntity->SendEvent(event);
}
if (!m_wasReEnabled && pEntity->GetPhysics() && pEntity->GetPhysics()->GetType() == PE_ROPE)
{
event.event = ENTITY_EVENT_LEVEL_LOADED;
pEntity->SendEvent(event);
}
}
else
{
prop.m_bIsNoAwake = false;
CPhysicalProxy* pPhProxy = pEntity->GetPhysicalProxy();
if (pPhProxy)
{
pe_status_awake isawake;
IPhysicalEntity* pPhEnt = pPhProxy->GetPhysicalEntity();
if (pPhEnt && pPhEnt->GetStatus(&isawake) == 0)
prop.m_bIsNoAwake = true;
}
pEntity->Hide(!isEnable);
pEntity->Activate(isEnable);
if (prop.m_bIsNoAwake && pEntity->GetPhysicalProxy() && pEntity->GetPhysicalProxy()->GetPhysicalEntity())
pEntity->GetPhysicalProxy()->GetPhysicalEntity()->Action(&noAwake);
}
}
if (!isEnable)
{
if (gEnv->pRenderer)
{
gEnv->pRenderer->ActivateLayer(m_name.c_str(), isEnable); // Want flash instances on materials deactivated after entities
}
}
else
m_wasReEnabled = true;
}
ReEvalNeedForHeap();
}