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


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

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


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

示例1: DetachProperty

void CEntityFactory::DetachProperty(CEntity& Entity, const nString& TypeName) const
{
	CPropertyInfo PropInfo;

	nString FullType = StrPropPrefix + TypeName;
	if (!PropertyMeta.Get(FullType.Get(), PropInfo))
		if (!PropertyMeta.Get(TypeName.Get(), PropInfo))
			n_error("No such property \"%s\"", TypeName.Get()); //???error?

	n_assert(PropInfo.pStorage);

#ifdef _DEBUG
	if (!PropInfo.pStorage->Contains(Entity.GetUniqueID()))
		n_error("CEntity::RemoveProperty: CProperty '%s' does not exist on entity!", TypeName.Get());
#endif

	(*PropInfo.pStorage)[Entity.GetUniqueID()]->ClearEntity(); //???need or there is always destructor?
	PropInfo.pStorage->Erase(Entity.GetUniqueID());
}
开发者ID:moltenguy1,项目名称:deusexmachina,代码行数:19,代码来源:EntityFactory.cpp

示例2: ODENearCallback

// The ODENearCallback for CShape::Collide.
//
// 31-May-05   floh    invert contact normal if necessary, the contact normal
//                     in ODE always points into pShape1, however, we want
//                     the contact normal always to point away from the
//                     "other" object
void CShape::ODENearCallback(void* data, dGeomID o1, dGeomID o2)
{
	CShape* pThis = (CShape*)data;

	// collide geom with sub-space
	if (dGeomIsSpace(o1) || dGeomIsSpace(o2))
	{
		dSpaceCollide2(o1, o2, data, &ODENearCallback);
		return;
	}

	CShape* pShape1 = CShape::GetShapeFromGeom(o1);
	CShape* pShape2 = CShape::GetShapeFromGeom(o2);
	CShape* pOtherShape;
	if (pShape1 == pThis) pOtherShape = pShape2;
	else if (pShape2 == pThis) pOtherShape = pShape1;
	else n_error("No self in collision");

	if (CShape::CollideFilterSet->CheckShape(pOtherShape)) return;

	// do collision detection, only check for one contact
	dContactGeom ODEContact;
	int CurrCollCount;
	if (pShape1 == pThis) CurrCollCount = dCollide(o1, o2, 1, &ODEContact, sizeof(dContactGeom));
	else CurrCollCount = dCollide(o2, o1, 1, &ODEContact, sizeof(dContactGeom));

	CContactPoint ContactPt;
	if (CurrCollCount > 0)
	{
		ContactPt.Position.set(ODEContact.pos[0], ODEContact.pos[1], ODEContact.pos[2]);
		ContactPt.UpVector.set(ODEContact.normal[0], ODEContact.normal[1], ODEContact.normal[2]);
		ContactPt.Material = pOtherShape->GetMaterialType();
		ContactPt.Depth = ODEContact.depth;
		CEntity* pEntity = pOtherShape->GetEntity();
		if (pEntity) ContactPt.EntityID = pEntity->GetUniqueID();
		CRigidBody* pRigidBody = pOtherShape->GetRigidBody();
		if (pRigidBody) ContactPt.RigidBodyID = pRigidBody->GetUniqueID();
		CShape::CollideContacts->Append(ContactPt);
	}
}
开发者ID:moltenguy1,项目名称:deusexmachina,代码行数:46,代码来源:Shape.cpp

示例3: DetachAllProperties

void CEntityFactory::DetachAllProperties(CEntity& Entity) const
{
	for (int i = 0; i < PropStorage.Size(); i++)
		PropStorage[i]->Erase(Entity.GetUniqueID());
}
开发者ID:moltenguy1,项目名称:deusexmachina,代码行数:5,代码来源:EntityFactory.cpp


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