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


C++ IEntity::GetEntityLinks方法代码示例

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


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

示例1: TriggerSpark

void CLightningArc::TriggerSpark()
{
	const char* targetName = "Target";
	IEntity* pEntity = GetEntity();

	if (pEntity->GetMaterial() == 0)
	{
		GameWarning("Lightning arc '%s' has no Material, no sparks will trigger", pEntity->GetName());
		return;
	}

	IEntityLink* pLinks = pEntity->GetEntityLinks();
	int numLinks = 0;
	for (IEntityLink* link = pLinks; link; link = link->next)
	{
		if (strcmp(link->name, targetName) == 0)
			++numLinks;
	}

	if (numLinks == 0)
	{
		GameWarning("Lightning arc '%s' has no Targets, no sparks will trigger", pEntity->GetName());
		return;
	}

	int nextSpark = Random(numLinks);
	IEntityLink* pNextSparkLink = pLinks;
	for (; nextSpark && pNextSparkLink; pNextSparkLink = pNextSparkLink->next)
	{
		if (strcmp(pNextSparkLink->name, targetName) == 0)
			--nextSpark;
	}

	CLightningGameEffect::TIndex id = g_pGame->GetLightningGameEffect()->TriggerSpark(
		m_lightningPreset,
		pEntity->GetMaterial(),
		CLightningGameEffect::STarget(GetEntityId()),
		CLightningGameEffect::STarget(pNextSparkLink->entityId));
	float strikeTime = g_pGame->GetLightningGameEffect()->GetSparkRemainingTime(id);
	IScriptTable* pTargetScriptTable = 0;
	IEntity* pTarget = gEnv->pEntitySystem->GetEntity(pNextSparkLink->entityId);
	if (pTarget)
		pTargetScriptTable = pTarget->GetScriptTable();

	EntityScripts::CallScriptFunction(pEntity, pEntity->GetScriptTable(), "OnStrike", strikeTime, pTargetScriptTable);
}
开发者ID:Xydrel,项目名称:Infected,代码行数:46,代码来源:LightningArc.cpp

示例2: BuildEntitySerializationList


//.........这里部分代码省略.........
		IAnimSequence* pSeq = gEnv->pMovieSystem->GetSequence(i);
		int nodeCount = pSeq->GetNodeCount();
		for(int j=0; j<nodeCount; ++j)
		{
			IAnimNode* pNode = pSeq->GetNode(j);
			if(pNode)
			{
				IEntity* pEntity = pNode->GetEntity();
				if(pEntity && ShouldSaveTrackViewEntityClass(pEntity)) 
				{
					MarkEntityForSerialize(entityData, pEntity, eST_TrackView);
				}

				if(EntityGUID* guid = pNode->GetEntityGuid())
				{
					EntityId id = gEnv->pEntitySystem->FindEntityByGuid(*guid);
					if(id != 0)
					{
						IEntity* pEntity2 = gEnv->pEntitySystem->GetEntity(id);
						MarkEntityForSerialize(entityData, pEntity2, eST_TrackView);
					}
				}
			}
		}
	}

	// now check entity links: any entity linked to or from a serialized
	//	entity must also be serialized
	for(TSerializationData::iterator it = entityData.begin(), end = entityData.end(); it != end; ++it)
	{
		IEntity* pEntity = gEnv->pEntitySystem->GetEntity(it->first);
		assert(pEntity);

		IEntityLink* pLink = pEntity->GetEntityLinks();
		while(pLink)
		{
			IEntity* pLinkedEntity = gEnv->pEntitySystem->GetEntity(pLink->entityId);
			assert(pLinkedEntity);

			MarkEntityForSerialize(entityData, pLinkedEntity, eST_Linked);

			pLink = pLink->next;
		}
	}

	// output the final file, plus debug info

#if SERIALIZATION_EXPORT_DEBUG
	int saveCount = 0;
	int totalCount = 0;

	int fgCount = 0;
	int fgRefCount = 0;
	int classCount = 0;
	int tvCount = 0;
	int childCount = 0;
	int parentCount = 0;
	int linkCount = 0;

	int fgUnique = 0;
	int fgRefUnique = 0;
	int classUnique = 0;
	int tvUnique = 0;
	int linkUnique = 0;

	typedef std::map<string, int> TClassSaveInfo;
开发者ID:aronarts,项目名称:FireNET,代码行数:67,代码来源:EditorGame.cpp


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