本文整理汇总了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);
}
示例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;