本文整理汇总了C++中IActorSystem::GetActorCount方法的典型用法代码示例。如果您正苦于以下问题:C++ IActorSystem::GetActorCount方法的具体用法?C++ IActorSystem::GetActorCount怎么用?C++ IActorSystem::GetActorCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IActorSystem
的用法示例。
在下文中一共展示了IActorSystem::GetActorCount方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnGameTokenEvent
//--------------------------------------------------------------
void CWeaponSystem::OnGameTokenEvent( EGameTokenEvent event,IGameToken *pGameToken )
{
assert(pGameToken);
if(EGAMETOKEN_EVENT_CHANGE == event)
{
bool handled = false;
if(!strcmp("weapon.effects.ice",pGameToken->GetName()))
{
pGameToken->GetValueAs(m_frozenEnvironment);
handled = true;
}
else if(!strcmp("weapon.effects.wet",pGameToken->GetName()))
{
pGameToken->GetValueAs(m_wetEnvironment);
handled = true;
}
if (handled)
{
IGameFramework* pGF = gEnv->pGame->GetIGameFramework();
IActorSystem* pAS = pGF->GetIActorSystem();
int count = pAS->GetActorCount();
if (count)
{
IActorIteratorPtr it = pAS->CreateActorIterator();
while (CActor* pActor = (CActor*)it->Next())
{
CPlayer *pPlayer = (pActor->GetActorClass() == CPlayer::GetActorClassType()) ? static_cast<CPlayer*>(pActor) : 0;
if (pPlayer && pPlayer->GetNanoSuit())
{
// go through all players and turn their ice effects on/off
IEntityRenderProxy* pRenderProxy = (IEntityRenderProxy*)pPlayer->GetEntity()->GetProxy(ENTITY_PROXY_RENDER);
if (pRenderProxy)
{
uint8 mask = pRenderProxy->GetMaterialLayersMask();
uint32 blend = pRenderProxy->GetMaterialLayersBlend();
mask = IsFrozenEnvironment() ? mask|MTL_LAYER_DYNAMICFROZEN : mask&~MTL_LAYER_DYNAMICFROZEN;
mask = IsWetEnvironment() ? mask|MTL_LAYER_WET : mask&~MTL_LAYER_WET;
pRenderProxy->SetMaterialLayersMask(mask);
pRenderProxy->SetMaterialLayersBlend(blend);
if (CItem* pItem = static_cast<CItem*>(pPlayer->GetCurrentItem(true)))
{
pItem->FrostSync(true);
pItem->WetSync(true);
}
if (COffHand* pOffHand = static_cast<COffHand*>(pPlayer->GetItemByClass(CItem::sOffHandClass)))
{
pOffHand->FrostSync(pOffHand->GetOffHandState() != eOHS_INIT_STATE);
pOffHand->WetSync(pOffHand->GetOffHandState() != eOHS_INIT_STATE);
}
}
}
}
}
}
}
}
示例2: OnActionDebugNextActor
bool CPlayerInput::OnActionDebugNextActor(EntityId entityId, const ActionId& actionId, int activationMode, float value)
{
IActorSystem* pActorSystem = gEnv->pGame->GetIGameFramework()->GetIActorSystem();
if (pActorSystem->GetActorCount() > 1)
{
EntityId currentEntityId = pActorSystem->SwitchDemoSpectator(0);
// Remote players should be viewed only in 3D mode with cl_cam_orbit set to 1
bool isPlayerViewed = (currentEntityId == entityId);
m_pPlayer->SetThirdPerson(!isPlayerViewed);
g_pGameCVars->cl_cam_orbit = isPlayerViewed ? 0 : 1;
}
return false;
}
示例3: OnPromoteToServer
//------------------------------------------------------------------------
bool CGameRules::OnPromoteToServer(SHostMigrationInfo& hostMigrationInfo, uint32& state)
{
if (!g_pGame->GetIGameFramework()->ShouldMigrateNub(hostMigrationInfo.m_session))
{
return true;
}
CryLogAlways("[Host Migration]: CGameRules::OnPromoteToServer() started");
// Server time will change after we migrate (change from old server time to new server time)
m_gameStartedTime.SetValue(m_gameStartedTime.GetValue() - m_cachedServerTime.GetValue());
m_gameStartTime.SetValue(m_gameStartTime.GetValue() - m_cachedServerTime.GetValue());
// If this migration has reset (we're not the original anticipated host, remove any entities from the first attempt
if (!m_hostMigrationCachedEntities.empty())
{
HostMigrationRemoveDuplicateDynamicEntities();
}
// Now we know we're the server, remove the actors for anyone we know isn't going to migrate
CGameLobby *pGameLobby = g_pGame->GetGameLobby();
CRY_ASSERT(pGameLobby);
if (pGameLobby)
{
TPlayers playersToRemove;
IActorSystem *pActorSystem = g_pGame->GetIGameFramework()->GetIActorSystem();
playersToRemove.reserve(pActorSystem->GetActorCount());
IActorIteratorPtr actorIt = pActorSystem->CreateActorIterator();
IActor *pActor;
while (pActor = actorIt->Next())
{
if (pActor->IsPlayer())
{
CRY_ASSERT(pActor->GetChannelId());
SCryMatchMakingConnectionUID conId = pGameLobby->GetConnectionUIDFromChannelID((int) pActor->GetChannelId());
if (pGameLobby->GetSessionNames().Find(conId) == SSessionNames::k_unableToFind)
{
CryLog(" player '%s' has not got a corresponding CGameLobby entry, removing actor", pActor->GetEntity()->GetName());
playersToRemove.push_back(pActor->GetEntityId());
}
}
}
const int numPlayersToRemove = playersToRemove.size();
for (int i = 0; i < numPlayersToRemove; ++ i)
{
FakeDisconnectPlayer(playersToRemove[i]);
}
}
for (uint32 i = 0; i < MAX_PLAYERS; ++ i)
{
m_migratedPlayerChannels[i] = 0;
}
IItemSystem *pItemSystem = g_pGame->GetIGameFramework()->GetIItemSystem();
IEntityItPtr it = gEnv->pEntitySystem->GetEntityIterator();
it->MoveFirst();
for (uint32 i = 0; i < m_hostMigrationItemMaxCount; ++ i)
{
m_pHostMigrationItemInfo[i].Reset();
}
uint32 itemIndex = 0;
IEntity *pEntity = NULL;
while (pEntity = it->Next())
{
IItem *pItem = pItemSystem->GetItem(pEntity->GetId());
if (pItem)
{
if (pItem->GetOwnerId())
{
IEntity *pOwner = gEnv->pEntitySystem->GetEntity(pItem->GetOwnerId());
if (pOwner)
{
EntityId currentItemId = 0;
IActor *pOwnerActor = g_pGame->GetIGameFramework()->GetIActorSystem()->GetActor(pOwner->GetId());
if (pOwnerActor)
{
IItem *pCurrentItem = pOwnerActor->GetCurrentItem();
currentItemId = pCurrentItem ? pCurrentItem->GetEntityId() : 0;
}
CryLog("[CG] Item '%s' is owned by '%s'", pEntity->GetName(), pOwner->GetName());
//m_pHostMigrationItemInfo[itemIndex].Set(pEntity->GetId(), pOwner->GetId(), pItem->IsUsed(), (pItem->GetEntityId() == currentItemId));
itemIndex ++;
if (itemIndex >= m_hostMigrationItemMaxCount)
{
CRY_ASSERT(itemIndex < m_hostMigrationItemMaxCount);
break;
}
}
}
//.........这里部分代码省略.........