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


C++ CEntity::GetPhysicalProxy方法代码示例

本文整理汇总了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));
}
开发者ID:joewan,项目名称:pycmake,代码行数:19,代码来源:EntityLayer.cpp

示例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();
}
开发者ID:joewan,项目名称:pycmake,代码行数:96,代码来源:EntityLayer.cpp


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