本文整理汇总了C++中IEntity::GetName方法的典型用法代码示例。如果您正苦于以下问题:C++ IEntity::GetName方法的具体用法?C++ IEntity::GetName怎么用?C++ IEntity::GetName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEntity
的用法示例。
在下文中一共展示了IEntity::GetName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RepairEntityId
bool CCheckpointSystem::RepairEntityId(EntityId &id, const char *pEntityName)
{
//EntityId's may change on level export -> fix id
if(pEntityName)
{
//test the original entity id
IEntity *pOriginalEntity = gEnv->pEntitySystem->GetEntity(id);
if(pOriginalEntity && !stricmp(pOriginalEntity->GetName(), pEntityName))
return true; //seems correct
IEntity *pNewEntity = gEnv->pEntitySystem->FindEntityByName(pEntityName);
if(!pNewEntity)
CryWarning(VALIDATOR_MODULE_GAME, VALIDATOR_WARNING, "Entity %s in loaded checkpoint could not be found. This means the checkpoint file is not compatible with this level version.", pEntityName);
else if(!stricmp(pNewEntity->GetName(), pEntityName))
{
//if the level was re-exported, the entity id might differ
CHECKPOINT_RESAVE_NECESSARY = true;
//this is a weakness of our entity system/editor and might be fixed in future
id = pNewEntity->GetId();
return true;
}
return false;
}
return false;
}
开发者ID:NightOwlsEntertainment,项目名称:PetBox_A_Journey_to_Conquer_Elementary_Algebra,代码行数:26,代码来源:CheckPointSystem.cpp
示例2: Shoot
//------------------------------------------------------------------------
void CDebugGun::Shoot(bool bPrimary)
{
CWeapon::StartFire();
// console cmd
string cmd;
cmd = (bPrimary) ? g_pGameCVars->i_debuggun_1->GetString() : g_pGameCVars->i_debuggun_2->GetString();
cmd += " ";
unsigned int flags = rwi_stop_at_pierceable|rwi_colltype_any;
if (m_fireModes[m_fireMode].first == "pierceability")
{
flags = (unsigned int)m_fireModes[m_fireMode].second & rwi_pierceability_mask;
}
IPhysicalWorld* pWorld = gEnv->pPhysicalWorld;
IPhysicalEntity *pSkip = GetOwnerActor()->GetEntity()->GetPhysics();
ray_hit rayhit;
CCamera& cam = GetISystem()->GetViewCamera();
Vec3 pos = cam.GetPosition()+cam.GetViewdir();
Vec3 dir = cam.GetViewdir() * HIT_RANGE;
IEntity* pEntity = 0;
if (pWorld->RayWorldIntersection(pos, dir, ent_all, flags, &rayhit, 1, &pSkip, 1))
{
pEntity = (IEntity*)rayhit.pCollider->GetForeignData(PHYS_FOREIGN_ID_ENTITY);
}
cmd.append(pEntity ? pEntity->GetName() : "0");
// if we execute an AI command take care of ai_debugdraw
if (cmd.substr(0, 3) == "ai_")
{
if (pEntity && m_pAIDebugDraw->GetIVal() == 0)
m_pAIDebugDraw->Set(1);
else if(!pEntity && m_aiDebugDrawPrev == 0 && m_pAIDebugDraw->GetIVal() == 1)
m_pAIDebugDraw->Set(0);
}
gEnv->pConsole->ExecuteString(cmd.c_str());
// if 2nd button hits a vehicle, enable movement profiling
if (!bPrimary)
{
static IVehicleSystem* pVehicleSystem = g_pGame->GetIGameFramework()->GetIVehicleSystem();
string vehicleCmd = "v_debugVehicle ";
vehicleCmd.append((pEntity && pVehicleSystem->GetVehicle(pEntity->GetId())) ? pEntity->GetName() : "0");
gEnv->pConsole->ExecuteString(vehicleCmd.c_str());
}
OnShoot(GetOwnerId(), 0, 0, pos, dir, Vec3(ZERO));
}
示例3: WriteMetaData
void CCheckpointSystem::WriteMetaData(EntityId checkpointId, XmlNodeRef parentNode, SCheckpointData &outMetaData)
{
XmlNodeRef node = GetISystem()->CreateXmlNode(META_DATA_SECTION);
const char *levelName = CCryAction::GetCryAction()->GetLevelName();
CRY_ASSERT(levelName);
CryFixedStringT<32> curlevelName = levelName;
RepairLevelName(curlevelName);
node->setAttr("Version", CHECKPOINT_VERSION_NUMBER);
node->setAttr("LevelName", curlevelName.c_str());
node->setAttr("CheckpointId", checkpointId);
//write checkpoint name to be independent of entityId
IEntity *pCheckpointEntity = gEnv->pEntitySystem->GetEntity(checkpointId);
if(pCheckpointEntity)
node->setAttr("CheckpointName", pCheckpointEntity->GetName());
else
node->setAttr("CheckpointName", "none");
string timeString;
GameUtils::timeToString(time(NULL), timeString);
node->setAttr("Timestamp", timeString.c_str());
parentNode->addChild(node);
//write back metadata for listeners
outMetaData.m_checkPointId = checkpointId;
outMetaData.m_levelName = levelName;
outMetaData.m_saveTime = timeString.c_str();
}
开发者ID:NightOwlsEntertainment,项目名称:PetBox_A_Journey_to_Conquer_Elementary_Algebra,代码行数:31,代码来源:CheckPointSystem.cpp
示例4: AddRecordComment
void CGameAIRecorder::AddRecordComment(EntityId requesterId, const char* szComment)
{
assert(szComment && szComment[0]);
assert(requesterId > 0);
assert(gEnv->bServer);
if (m_bIsRecording && szComment && szComment[0])
{
if (!gEnv->bServer)
{
CryLogAlways("[AI] Recorder comment requested on Client. Only the Server can do this!");
return;
}
IEntity *pEntity = gEnv->pEntitySystem->GetEntity(requesterId);
IAIObject *pAI = pEntity ? pEntity->GetAI() : NULL;
if (!pAI)
{
CryLogAlways("[AI] Attempting to add recorder comment, but the requester does not have an AI!");
return;
}
// Output to log
CryLogAlways("[AI] --- RECORDER COMMENT ADDED ---");
CryLogAlways("[AI] By: %s", pEntity->GetName());
CryLogAlways("[AI] Comment: %s", szComment);
// Add comment to stream
RecordLuaComment(pAI, "Comment: %s", szComment);
}
}
示例5: StartFire
//------------------------------------------------------------------------
void CDetonate::StartFire()
{
if (CanFire(false))
{
CActor *pOwner=m_pWeapon->GetOwnerActor();
CCCPOINT(DetonateFireMode_StartFireOK);
m_pWeapon->RequireUpdate(eIUS_FireMode);
m_detonationTimer = 0.1f;
m_pWeapon->PlayAction(GetFragmentIds().fire);
m_pWeapon->RequestDetonate();
}
else
{
#if !defined(_RELEASE)
IFireMode* pFM = m_pWeapon->GetFireMode(m_pWeapon->GetCurrentFireMode());
EntityId projectileId = pFM ? pFM->GetProjectileId() : 0;
IEntity * projectile = gEnv->pEntitySystem->GetEntity(projectileId);
CryLog ("[Detonate] Failure to detonate %s '%s' (timer = %.4f, can detonate = %s, fire mode = '%s') projectile = %u (%s '%s')",
m_pWeapon->GetEntity()->GetClass()->GetName(),
m_pWeapon->GetEntity()->GetName(),
m_detonationTimer,
m_canDetonate ? "TRUE" : "FALSE",
pFM ? pFM->GetName() : "NONE",
projectileId,
projectile ? projectile->GetClass()->GetName() : "NONE",
projectile ? projectile->GetName() : "N/A");
#endif
CCCPOINT_IF(m_detonationTimer > 0.0f, DetonateFireMode_CannotFire_TimerNotReachedZero);
CCCPOINT(DetonateFireMode_CannotFire);
}
}
示例6: SpawnDetachedEntity
//------------------------------------------------------------------------
IEntity* CVehicleDamageBehaviorDetachPart::SpawnDetachedEntity()
{
IEntity* pVehicleEntity = m_pVehicle->GetEntity();
CRY_ASSERT(pVehicleEntity);
// spawn the detached entity
char pPartName[128];
_snprintf(pPartName, 128, "%s_DetachedPart_%s", pVehicleEntity->GetName(), m_partName.c_str());
pPartName[sizeof(pPartName)-1] = '\0';
SEntitySpawnParams spawnParams;
spawnParams.sName = pPartName;
spawnParams.bCreatedThroughPool = true;
spawnParams.nFlags = ENTITY_FLAG_CLIENT_ONLY;
if(!m_pickableDebris)
spawnParams.nFlags |= ENTITY_FLAG_NO_PROXIMITY;
spawnParams.pClass = gEnv->pEntitySystem->GetClassRegistry()->FindClass("VehiclePartDetached");
if (!spawnParams.pClass)
{
CRY_ASSERT(0);
return NULL;
}
return gEnv->pEntitySystem->SpawnEntity(spawnParams, true);
}
示例7: Init
//---------------------------------------
void CAreaAnnouncer::Init()
{
Reset();
//Scan for areas
IEntityClass* pTargetClass = gEnv->pEntitySystem->GetClassRegistry()->FindClass("AreaBox");
CRY_ASSERT_MESSAGE(pTargetClass, "Unable to find Target class AreaBox");
if(pTargetClass)
{
IEntityIt* it = gEnv->pEntitySystem->GetEntityIterator();
while ( !it->IsEnd() )
{
IEntity* pEntity = it->Next();
if(pEntity->GetClass() == pTargetClass)
{
//check entityName
IEntityAreaProxy *pArea = (IEntityAreaProxy*)pEntity->GetProxy(ENTITY_PROXY_AREA);
if (pArea)
{
LoadAnnouncementArea(pEntity, pEntity->GetName());
}
}
}
it->Release();
}
CGameRules *pGameRules = g_pGame->GetGameRules();
pGameRules->RegisterRevivedListener(this);
}
示例8: 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);
}
示例9: StoreMigratingPlayer
//------------------------------------------------------------------------
void CGameRules::StoreMigratingPlayer(IActor* pActor)
{
if (pActor == NULL)
{
GameWarning("Invalid data for migrating player");
return;
}
IEntity* pEntity = pActor->GetEntity();
EntityId id = pEntity->GetId();
bool registered = false;
uint16 channelId = pActor->GetChannelId();
CRY_ASSERT(channelId);
bool bShouldAdd = true;
CGameLobby *pGameLobby = g_pGame->GetGameLobby();
CRY_ASSERT(pGameLobby);
if (pGameLobby)
{
SCryMatchMakingConnectionUID conId = pGameLobby->GetConnectionUIDFromChannelID((int) channelId);
if (pGameLobby->GetSessionNames().Find(conId) == SSessionNames::k_unableToFind)
{
CryLog("CGameRules::StoreMigratingPlayer() player %s (channelId=%u) has already left the game, not storing", pEntity->GetName(), channelId);
bShouldAdd = false;
}
}
if (bShouldAdd && (!m_hostMigrationCachedEntities.empty()))
{
if (!stl::find(m_hostMigrationCachedEntities, pActor->GetEntityId()))
{
bShouldAdd = false;
}
}
if (bShouldAdd)
{
for (uint32 index = 0; index < m_migratingPlayerMaxCount; ++index)
{
if (!m_pMigratingPlayerInfo[index].InUse())
{
m_pMigratingPlayerInfo[index].SetData(pEntity->GetName(), id, GetTeam(id), pEntity->GetWorldPos(), pEntity->GetWorldAngles(), pActor->GetHealth());
m_pMigratingPlayerInfo[index].SetChannelID(channelId);
registered = true;
break;
}
}
}
pEntity->Hide(true); // Hide the player, they will be unhidden when they rejoin
if (!registered && bShouldAdd)
{
GameWarning("Too many migrating players!");
}
}
示例10: SpawnAICorpseFromEntity
EntityId CAICorpseManager::SpawnAICorpseFromEntity( IEntity& sourceEntity, const SCorpseParameters& corpseParams )
{
assert(gEnv->IsEditor() == false);
assert(gEnv->bMultiplayer == false);
if(g_pGameCVars->g_aiCorpses_Enable == 0)
return 0;
if(m_corpsesArray.size() == m_maxCorpses)
{
RemoveSomeCorpses();
assert((uint32)m_corpsesArray.size() < m_maxCorpses);
}
MEMSTAT_CONTEXT(EMemStatContextTypes::MSC_Other, EMemStatContextFlags::MSF_None, "AICorpseManager::SpawnCorpse");
EntityId corpseId = 0;
IPhysicalEntity* pSourcePhysics = sourceEntity.GetPhysics();
if ((pSourcePhysics != NULL) && (pSourcePhysics->GetType() == PE_ARTICULATED))
{
ICharacterInstance *pSourceCharacterInstance = sourceEntity.GetCharacter(0);
if (pSourceCharacterInstance != NULL)
{
IEntityClass *pCorpseClass = gEnv->pEntitySystem->GetClassRegistry()->FindClass("AICorpse");
assert(pCorpseClass);
stack_string corpseName;
corpseName.Format("%s_Corpse", sourceEntity.GetName());
SEntitySpawnParams params;
params.pClass = pCorpseClass;
params.sName = corpseName.c_str();
#if !AI_CORPSES_ENABLE_SERIALIZE
params.nFlags |= ENTITY_FLAG_NO_SAVE;
#endif
params.vPosition = sourceEntity.GetWorldPos();
params.qRotation = sourceEntity.GetWorldRotation();
IEntity *pCorpseEntity = gEnv->pEntitySystem->SpawnEntity(params, true);
if(pCorpseEntity != NULL)
{
corpseId = pCorpseEntity->GetId();
CorpseInfo* pCorpseInfo = FindCorpseInfo( corpseId );
assert(pCorpseInfo != NULL);
CAICorpse* pCorpse = pCorpseInfo->GetCorpse();
assert(pCorpse != NULL);
pCorpse->SetupFromSource( sourceEntity, *pSourceCharacterInstance, (uint32)corpseParams.priority);
}
}
}
return corpseId;
}
示例11: GetEntityName
static const char * GetEntityName()
{
IEntity * pEnt = gEnv->pEntitySystem->GetEntity(_netinputchain_debugentity);
assert(pEnt);
if (pEnt)
return pEnt->GetName();
else
return "<<unknown>>";
}
示例12: SetTrackedEntity
void CHUDMissionObjective::SetTrackedEntity(EntityId entityId)
{
IEntity *pEntity = gEnv->pEntitySystem->GetEntity(entityId);
if (pEntity)
{
m_trackedEntity = pEntity->GetName();
m_trackedEntityId = entityId;
}
}
示例13:
CDialogActorContext::~CDialogActorContext()
{
StopSound();
CancelCurrent();
IEntity* pEntity = gEnv->pEntitySystem->GetEntity(m_entityID);
const char* debugName = pEntity ? pEntity->GetName() : "<no entity>";
DiaLOG::Log(DiaLOG::eAlways, "[DIALOG] CDialogActorContext::dtor: %s 0x%p actorID=%d entity=%s entityId=%d",
m_pSession->GetDebugName(), this, m_actorID, debugName, m_entityID);
}
示例14: AddEntityTag
void CPersistantDebug::AddEntityTag(const SEntityTagParams& params, const char *tagContext)
{
// Create tag
SEntityTag tag;
tag.params = params;
tag.params.column = max(1, tag.params.column);
tag.params.visibleTime = max(0.f, tag.params.visibleTime);
tag.params.fadeTime = max(0.f, tag.params.fadeTime);
if (tagContext != NULL && *tagContext != '\0')
tag.params.tagContext = tagContext;
tag.totalTime = tag.params.visibleTime + tag.params.fadeTime;
tag.totalFadeTime = tag.params.fadeTime;
tag.vScreenPos.zero();
SObj *obj = FindObj(params.entity);
if (!obj)
{
// Create new object to push back
SObj sobj;
sobj.obj = eOT_EntityTag;
sobj.entityId = params.entity;
sobj.entityHeight = 0.f;
sobj.timeRemaining = tag.totalTime;
sobj.totalTime = tag.totalTime;
sobj.columns.resize(params.column);
AddToTagList(sobj.tags, tag);
m_objects[entityTagsContext].push_back(sobj);
}
else
{
obj->timeRemaining = max(obj->timeRemaining, tag.totalTime);
obj->totalTime = obj->timeRemaining;
int size = max(int(obj->columns.size()), params.column);
if (obj->columns.size() < size)
obj->columns.resize(size);
AddToTagList(obj->tags, tag);
}
if (m_pETLog->GetIVal() > 0)
{
IEntity *ent = gEnv->pEntitySystem->GetEntity(params.entity);
if (ent)
{
CryLog("[Entity Tag] %s added tag: %s", ent->GetName(), params.text.c_str());
if (m_pETLog->GetIVal() > 1)
{
char text[256];
_snprintf(text, sizeof(text), "[Entity Tag] %s", params.text.c_str());
gEnv->pAISystem->Record(ent->GetAI(), IAIRecordable::E_NONE, text);
}
}
}
}
示例15:
//------------------------------------------------------------------------
IMPLEMENT_RMI(CGameRules, ClHostMigrationPlayerJoined)
{
const EntityId playerId = params.entityId;
#if !defined(_RELEASE)
IEntity *pPlayer = gEnv->pEntitySystem->GetEntity(playerId);
CryLog("CGameRules::ClHostMigrationPlayerJoined() '%s'", pPlayer ? pPlayer->GetName() : "<NULL>");
#endif
// todo: ui
return true;
}