本文整理汇总了C++中IEntityItPtr::IsEnd方法的典型用法代码示例。如果您正苦于以下问题:C++ IEntityItPtr::IsEnd方法的具体用法?C++ IEntityItPtr::IsEnd怎么用?C++ IEntityItPtr::IsEnd使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEntityItPtr
的用法示例。
在下文中一共展示了IEntityItPtr::IsEnd方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
}
}
}
}
示例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: OnStep
EContextEstablishTaskResult OnStep( SContextEstablishState& state )
{
CScopedRemoveObjectUnlock unlockRemovals(CCryAction::GetCryAction()->GetGameContext());
if (m_skipGameRules || m_skipPlayers)
{
IEntityItPtr i = gEnv->pEntitySystem->GetEntityIterator();
while(!i->IsEnd())
{
IEntity* pEnt = i->Next();
// skip gamerules
if (m_skipGameRules)
if (pEnt->GetId() == CCryAction::GetCryAction()->GetIGameRulesSystem()->GetCurrentGameRulesEntity()->GetId())
continue;
// skip players
if (m_skipPlayers)
{
IActor* pActor = CCryAction::GetCryAction()->GetIActorSystem()->GetActor(pEnt->GetId());
if (pActor && pActor->IsPlayer())
continue;
}
pEnt->ClearFlags(ENTITY_FLAG_UNREMOVABLE);
// force remove all other entities
gEnv->pEntitySystem->RemoveEntity(pEnt->GetId(), true);
}
if (!m_skipGameRules)
gEnv->pEntitySystem->ReserveEntityId(1);
}
else
{
if(!gEnv->pSystem->IsSerializingFile())
gEnv->pEntitySystem->Reset();
gEnv->pEntitySystem->ReserveEntityId(1);
}
gEnv->pEntitySystem->ReserveEntityId( LOCAL_PLAYER_ENTITY_ID );
CActionGame::Get()->OnEntitySystemReset();
return eCETR_Ok;
}
示例4: GetEntitiesByClasses
mono::object CScriptbind_Entity::GetEntitiesByClasses(mono::object classes)
{
IMonoArray *pClassArray = *classes;
int numClasses = pClassArray->GetSize();
IEntityClass **pClasses = new IEntityClass *[numClasses];
for(int i = 0; i < numClasses; i++)
pClasses[i] = gEnv->pEntitySystem->GetClassRegistry()->FindClass(ToCryString((mono::string)pClassArray->GetManagedObject()));
IEntityItPtr pIt = gEnv->pEntitySystem->GetEntityIterator();
IMonoClass *pEntityIdClass = GetMonoScriptSystem()->GetCryBraryAssembly()->GetClass("EntityId");
IMonoArray *pEntities = CreateDynamicMonoArray();
pIt->MoveFirst();
while(!pIt->IsEnd())
{
if(IEntity *pEntity = pIt->Next())
{
IEntityClass *pEntityClass = pEntity->GetClass();
for(int i = 0; i < numClasses; i++)
{
if(pEntityClass == pClasses[i])
{
pEntities->InsertMonoObject(pEntityIdClass->BoxObject(&mono::entityId(pEntity->GetId())));
break;
}
}
}
}
auto result = pEntities->GetManagedObject();
pEntities->Release();
return result;
}
示例5: GetEntitiesByClass
mono::object CScriptbind_Entity::GetEntitiesByClass(mono::string _class)
{
IEntityClass *pDesiredClass = gEnv->pEntitySystem->GetClassRegistry()->FindClass(ToCryString(_class));
IEntityItPtr pIt = gEnv->pEntitySystem->GetEntityIterator();
IMonoClass *pEntityIdClass = GetMonoScriptSystem()->GetCryBraryAssembly()->GetClass("EntityId");
IMonoArray *pEntities = CreateDynamicMonoArray();
pIt->MoveFirst();
while(!pIt->IsEnd())
{
if(IEntity *pEntity = pIt->Next())
{
if(pEntity->GetClass() == pDesiredClass)
pEntities->InsertMonoObject(pEntityIdClass->BoxObject(&mono::entityId(pEntity->GetId())));
}
}
auto result = pEntities->GetManagedObject();
pEntities->Release();
return result;
}
示例6: Update
void CMPTutorial::Update()
{
FUNCTION_PROFILER(GetISystem(), PROFILE_GAME);
if(!m_enabled && g_pGameCVars->g_PSTutorial_Enabled)
EnableTutorialMode(true);
else if(m_enabled && !g_pGameCVars->g_PSTutorial_Enabled)
EnableTutorialMode(false);
m_currentEvent.m_msgDisplayTime -= gEnv->pTimer->GetFrameTime();
if(!m_enabled)
{
if(m_currentEvent.m_msgDisplayTime < 0.0f && m_currentEvent.m_msgRemovalCondition != eMRC_None)
{
m_currentEvent.m_msgRemovalCondition = eMRC_None;
SAFE_HUD_FUNC(ShowTutorialText(NULL,1));
}
}
// update the text... must be done even if not enabled, to ensure the 'you may reenable...'
// message is shown correctly.
if(m_currentEvent.m_numChunks > 0)
{
// calculate how far through the current sound we are
CTimeValue now = gEnv->pTimer->GetFrameStartTime();
float soundTimer = now.GetMilliSeconds() - m_currentEvent.m_soundStartTime;
assert(soundTimer >= 0);
float soundPercent = 1.0f;
if(m_currentEvent.m_soundLength == 0.0f && m_currentEvent.m_pCurrentSound.get())
{
m_currentEvent.m_soundLength = m_currentEvent.m_pCurrentSound->GetLengthMs();
}
if(m_currentEvent.m_soundLength > 0.0f)
{
soundPercent = soundTimer / m_currentEvent.m_soundLength;
}
for(int i=m_currentEvent.m_numChunks-1; i > m_currentEvent.m_currentChunk; --i)
{
if(m_currentEvent.m_chunks[i].m_startPercent <= soundPercent)
{
m_currentEvent.m_currentChunk = i;
int pos = 2; // 2=bottom, 1=middle
IActor *pClientActor = g_pGame->GetIGameFramework()->GetClientActor();
if(pClientActor && pClientActor->GetLinkedVehicle())
{
pos = 1;
}
SAFE_HUD_FUNC(ShowTutorialText(m_currentEvent.m_chunks[i].m_text, pos));
break;
}
}
}
if(!m_enabled)
return;
CPlayer* pPlayer = static_cast<CPlayer*>(g_pGame->GetIGameFramework()->GetClientActor());
if(!pPlayer)
return;
// don't start until game begins
if(pPlayer->GetSpectatorMode() != 0 || g_pGame->GetGameRules()->GetCurrentStateId() != 3)
return;
if(!m_initialised)
{
m_initialised = true;
if(g_pGame->GetHUD())
{
// register as a HUD listener
g_pGame->GetHUD()->RegisterListener(this);
}
// go through entity list and pull out the factories.
IEntityItPtr pIt = gEnv->pEntitySystem->GetEntityIterator();
while (!pIt->IsEnd())
{
if (IEntity * pEnt = pIt->Next())
{
if(pEnt->GetClass() == m_pHQClass)
{
m_baseList.push_back(pEnt->GetId());
//CryLog("Adding HQ %d to list: %d", pEnt->GetId(), m_baseList.size());
}
else if(pEnt->GetClass() == m_pAlienEnergyPointClass)
{
m_alienEnergyPointList.push_back(pEnt->GetId());
//CryLog("Adding AEP %d to list: %d", pEnt->GetId(), m_alienEnergyPointList.size());
}
else if(pEnt->GetClass() == m_pSpawnGroupClass)
{
m_spawnGroupList.push_back(pEnt->GetId());
//CryLog("Adding spawngroup %d to list: %d", pEnt->GetId(), m_spawnGroupList.size());
}
else if(pEnt->GetClass() == m_pFactoryClass)
{
m_factoryList.push_back(pEnt->GetId());
//.........这里部分代码省略.........
示例7: OnPostUpdate
virtual void OnPostUpdate(float fDeltaTime)
{
// Get it once, then unregister to prevent unnescessary updates
if(!m_get)
{
gEnv->pGame->GetIGameFramework()->UnregisterListener(this);
return;
}
m_get = false;
// Grab the container, and make sure its valid (user has to create it for us and pass the valid ID)
IFlowSystemContainerPtr pContainer = gEnv->pFlowSystem->GetContainer(GetPortInt(&m_actInfo, EIP_ContainerId));
if(!pContainer)
return;
IEntityItPtr pIt = gEnv->pEntitySystem->GetEntityIterator();
while (!pIt->IsEnd())
{
if (IEntity *pEntity = pIt->Next())
{
//skip Local player
if (IPhysicalEntity *physEnt = pEntity->GetPhysics())
{
IActor *pClientActor = gEnv->pGame->GetIGameFramework()->GetClientActor();
if (!pClientActor)
return;
//skip the client actor entity
if (physEnt == pClientActor->GetEntity()->GetPhysics())
continue;
AABB worldBounds;
pEntity->GetWorldBounds(worldBounds);
//skip further calculations if the entity is not visible at all...
if (gEnv->pSystem->GetViewCamera().IsAABBVisible_F(worldBounds) == CULL_EXCLUSION)
continue;
Vec3 wpos = pEntity->GetWorldPos();
Quat rot = pEntity->GetWorldRotation();
AABB localBounds;
pEntity->GetLocalBounds(localBounds);
//get min and max values of the entity bounding box (local positions)
Vec3 points[2];
points[0] = wpos + rot * localBounds.min;
points[1] = wpos + rot * localBounds.max;
Vec3 pointsProjected[2];
//project the bounding box min max values to screen positions
for (int i=0; i<2; ++i)
{
gEnv->pRenderer->ProjectToScreen(points[i].x, points[i].y, points[i].z, &pointsProjected[i].x, &pointsProjected[i].y, &pointsProjected[i].z);
const float fWidth = (float)gEnv->pRenderer->GetWidth();
const float fHeight = (float)gEnv->pRenderer->GetHeight();
//scale projected values to the actual screen resolution
pointsProjected[i].x *= 0.01f * fWidth;
pointsProjected[i].y *= 0.01f * fHeight;
}
//check if the projected bounding box min max values are fully or partly inside the screen selection
if ((m_screenX <= pointsProjected[0].x && pointsProjected[0].x <= m_screenX2) ||
(m_screenX >= pointsProjected[0].x && m_screenX2 <= pointsProjected[1].x) ||
(m_screenX <= pointsProjected[1].x && m_screenX2 >= pointsProjected[1].x) ||
(m_screenX <= pointsProjected[0].x && m_screenX2 >= pointsProjected[1].x))
{
if ((m_screenY <= pointsProjected[0].y && m_screenY2 >= pointsProjected[0].y) ||
(m_screenY <= pointsProjected[1].y && m_screenY2 >= pointsProjected[0].y) ||
(m_screenY <= pointsProjected[1].y && m_screenY2 >= pointsProjected[1].y))
{
// Add entity to container
pContainer->AddItem(TFlowInputData(pEntity->GetId()));
}
}
}
}
}
}
开发者ID:NightOwlsEntertainment,项目名称:PetBox_A_Journey_to_Conquer_Elementary_Algebra,代码行数:85,代码来源:FlowMouseInfo.cpp
示例8: 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();
}
}