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


C++ IEntitySystem::GetEntityIterator方法代码示例

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


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

示例1: OnIterStart

	virtual void OnIterStart(SActivationInfo *pActInfo)
	{
		const int type = GetPortInt(pActInfo, EIP_Type);

		IEntitySystem *pEntitySystem = gEnv->pEntitySystem;
		if (pEntitySystem)
		{
			IEntityItPtr iter = pEntitySystem->GetEntityIterator();
			if (iter)
			{
				iter->MoveFirst();
				IEntity *pEntity = NULL;
				while (!iter->IsEnd())
				{
					pEntity = iter->Next();
					if (pEntity)
					{
						const EntityId id = pEntity->GetId();
						const EEntityType entityType = GetEntityType(id);
						if (IsValidType(type, entityType))
						{
							AddEntity(id);
						}
					}
				}
			}
		}
	}
开发者ID:aronarts,项目名称:FireNET,代码行数:28,代码来源:FlowEntityIterator.cpp

示例2: DeleteDynamicEntities

void CCheckpointSystem::DeleteDynamicEntities()
{
	IEntitySystem *pEntitySystem = gEnv->pEntitySystem;
	IEntityItPtr pIt = pEntitySystem->GetEntityIterator();
	//////////////////////////////////////////////////////////////////////////
	pIt->MoveFirst();
	while (!pIt->IsEnd())
	{
		IEntity * pEntity = pIt->Next();
		uint32 nEntityFlags = pEntity->GetFlags();

		// Local player must not be deleted.
		if (nEntityFlags & ENTITY_FLAG_LOCAL_PLAYER)
			continue;

		if (nEntityFlags & ENTITY_FLAG_SPAWNED)
			pEntitySystem->RemoveEntity( pEntity->GetId() );
	}
	// Force deletion of removed entities.
	pEntitySystem->DeletePendingEntities();
	//////////////////////////////////////////////////////////////////////////

	// Reset entity pools
	pEntitySystem->GetIEntityPoolManager()->ResetPools(false);
}
开发者ID:NightOwlsEntertainment,项目名称:PetBox_A_Journey_to_Conquer_Elementary_Algebra,代码行数:25,代码来源:CheckPointSystem.cpp

示例3: GetAdditionalMinimapData

//////////////////////////////////////////////////////////////////////////
//
// Allows the game code to write game-specific data into the minimap xml
// file on level export. Currently used to export data to StatsTool
//
//////////////////////////////////////////////////////////////////////////
bool CEditorGame::GetAdditionalMinimapData(XmlNodeRef output)
{
	string classes = g_pGameCVars->g_telemetryEntityClassesToExport;
	if(!classes.empty())
	{
		// additional data relating to StatsTool
		XmlNodeRef statsNode = output->findChild("StatsTool");
		if(!statsNode)
		{
			statsNode = GetISystem()->CreateXmlNode("StatsTool");
			output->addChild(statsNode);
		}
		else
		{
			statsNode->removeAllChilds();
		}

		// first build a list of entity classes from the cvar
		std::vector<IEntityClass*> interestingClasses;
		int curPos = 0;
		string currentClass = classes.Tokenize(",",curPos);
		IEntitySystem* pES = GetISystem()->GetIEntitySystem();
		if(IEntityClassRegistry* pClassReg = pES->GetClassRegistry())
		{
			while (!currentClass.empty())
			{
				if(IEntityClass* pClass = pClassReg->FindClass(currentClass.c_str()))
				{
					interestingClasses.push_back(pClass);
				}

				currentClass = classes.Tokenize(",",curPos);
			}
		}

		// now iterate through all entities and save the ones which match the classes
		if(interestingClasses.size() > 0)
		{
			IEntityItPtr it = pES->GetEntityIterator();
			while(IEntity* pEntity = it->Next())
			{
				if(stl::find(interestingClasses, pEntity->GetClass()))
				{
					XmlNodeRef entityNode = GetISystem()->CreateXmlNode("Entity");
					statsNode->addChild(entityNode);

					entityNode->setAttr("class", pEntity->GetClass()->GetName());
					Vec3 pos = pEntity->GetWorldPos();
					entityNode->setAttr("x", pos.x);
					entityNode->setAttr("y", pos.y);
					entityNode->setAttr("z", pos.z);
				}
			}
		}
	}

	return true;
}
开发者ID:aronarts,项目名称:FireNET,代码行数:64,代码来源:EditorGame.cpp

示例4: Validate

void CBaseManager::Validate(BuildingGUID nGUID)
{
	ControllerList ValidateList;
	ControllerList::iterator itBuilding = m_ControllerList.begin();
	if (GUID_INVALID != nGUID)
	{
		// Find it
		itBuilding = m_ControllerList.find(nGUID);

		// Check if it is ready to be validated
		if (true == itBuilding->second->BeforeValidate())
			ValidateList[itBuilding->first] = itBuilding->second;
	}
	else
	{
		// Check all of them
		for (itBuilding; itBuilding != m_ControllerList.end(); itBuilding++)
		{
			if (true == itBuilding->second->BeforeValidate())
				ValidateList.insert(ControllerList::value_type(itBuilding->first,itBuilding->second));
		}
	}
	if (true == ValidateList.empty()) return; // Must have something to continue with

	// Look for new interfaces and tell them they now represent me
	IEntity *pEntity = NULL;
	IEntitySystem *pES = gEnv->pEntitySystem;
	IEntityItPtr pIt = pES->GetEntityIterator();
	while (false == pIt->IsEnd())
	{
		if (NULL != (pEntity = pIt->Next()))
		{
			// Check if it has a CNCBuilding property table and that it is
			//	interfacing this particular one
			IScriptTable *pTable;
			if (NULL != pEntity && NULL != (pTable = pEntity->GetScriptTable()))
			{
				// Get property table
				SmartScriptTable props, cncbuilding;
				if (true == pTable->GetValue("Properties", props) &&
					true == props->GetValue("CNCBuilding", cncbuilding))
				{
					// Extract and build GUID
					char const* szTeam = 0;
					char const* szClass = 0;
					cncbuilding->GetValue("Team", szTeam);
					cncbuilding->GetValue("Class", szClass);
					BuildingGUID GUID = g_D6Core->pBaseManager->GenerateGUID(szTeam, szClass);
					itBuilding = ValidateList.find(GUID);
					if (itBuilding != ValidateList.end())
						itBuilding->second->AddInterface(pEntity);
				}
			}
		}
	}

	// And finally, validate them all
	for (itBuilding = ValidateList.begin(); itBuilding != ValidateList.end(); itBuilding++)
	{
		itBuilding->second->Validate();
	}
}
开发者ID:RenEvo,项目名称:dead6,代码行数:62,代码来源:CBaseManager.cpp


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