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


C++ IActor::GetChannelId方法代码示例

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


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

示例1: ProcessEvent

	virtual void ProcessEvent( EFlowEvent event, SActivationInfo *pActInfo )
	{
		switch (event)
		{
		case eFE_Initialize:
		case eFE_Activate:
			{
				IActorSystem *pActorSystem = gEnv->pGame->GetIGameFramework()->GetIActorSystem();
				IActorIteratorPtr actorIt = pActorSystem->CreateActorIterator();
				int iNumPlayers = 0;
				IActor *pActor = actorIt->Next();
				while(iNumPlayers < 4 && pActor)
				{
					if(pActor->GetChannelId())
					{
						ActivateOutput(pActInfo, iNumPlayers, pActor->GetEntityId());
						++iNumPlayers;
					}

					pActor = actorIt->Next();
				}
			}
			break;
		}
	}
开发者ID:NightOwlsEntertainment,项目名称:PetBox_A_Journey_to_Conquer_Elementary_Algebra,代码行数:25,代码来源:FlowGameNodes.cpp

示例2: InitClient

void CHeavyWeapon::InitClient( int channelId )
{
    BaseClass::InitClient(channelId);

    IActor *pActor = GetOwnerActor();
    if(pActor && pActor->GetChannelId() != channelId)
        {
            EntityId ownerId = pActor->GetEntityId();
            GetGameObject()->InvokeRMIWithDependentObject(ClHeavyWeaponUsed(), SHeavyWeaponUserParams(ownerId), eRMI_ToClientChannel, ownerId, channelId);
        }
    else if(m_bIsHighlighted)
        {
            GetGameObject()->InvokeRMI(ClHeavyWeaponHighlighted(), SNoParams(), eRMI_ToClientChannel, channelId);
        }
}
开发者ID:eBunny,项目名称:EmberProject,代码行数:15,代码来源:HeavyWeapon.cpp

示例3: Update

//------------------------------------------------------------------------
void CGameRulesMPDamageHandling::Update(float frameTime)
{
	FUNCTION_PROFILER(gEnv->pSystem, PROFILE_GAME);

	float currentTime = gEnv->pTimer->GetCurrTime();
	m_entityLastDamageUpdateTimer += frameTime;
	if (m_entityLastDamageUpdateTimer > EntityCollisionLatentUpdateTimer)
	{
		m_entityLastDamageUpdateTimer = 0.0f;

		if (!m_entityCollisionRecords.empty())
		{
			EntityCollisionRecords::iterator it = m_entityCollisionRecords.begin();
			while (it != m_entityCollisionRecords.end())
			{
				const EntityCollisionRecord& record = it->second;

				if ((record.time + EntityCollisionIgnoreTimeBetweenCollisions) < currentTime)
				{
					m_entityCollisionRecords.erase(it++);
				}
				else
				{
					++it;
				}
			}
		}
	}

	UpdateKickableCarRecords(frameTime, currentTime);

	if (gEnv->IsClient())
	{

#ifndef _RELEASE
		if (g_pGameCVars->pl_melee.mp_victim_screenfx_dbg_force_test_duration > 0.f)
		{
			m_localMeleeScreenFxTimer = (g_pGameCVars->pl_melee.mp_victim_screenfx_dbg_force_test_duration + g_pGameCVars->pl_melee.mp_victim_screenfx_blendout_duration);
			g_pGameCVars->pl_melee.mp_victim_screenfx_dbg_force_test_duration = 0.f;
		}
#endif

		if (m_localMeleeScreenFxTimer > 0.f)
		{
			UpdateLocalMeleeScreenFx(frameTime);
		}
	}

#ifdef SERVER_CHECKS
	//Iterate over unverified hits and see if there are any that haven't been assigned shots for X seconds
	const float fCurrentTime = gEnv->pTimer->GetCurrTime();
	int nNumUnverifiedHits = m_unverifiedList.size();
	static const float kMaxTimeUnverified = 5.0f;

	const float kDeleteUnverifiedBeforeThis = fCurrentTime - kMaxTimeUnverified;

	for(int i = 0; i < nNumUnverifiedHits; i++)
	{
		const SUnverifiedFireData &rUnverifiedData = m_unverifiedList[i];
		if(kDeleteUnverifiedBeforeThis > rUnverifiedData.fTime)
		{
			CGameRules * pGameRules = g_pGame->GetGameRules();
			if(pGameRules)
			{
				IActor * pActor = pGameRules->GetActorByChannelId(rUnverifiedData.uChannelId);
				if(pActor)
				{
					g_pGame->GetAntiCheatManager()->FlagActivity(eCT_HitShotIdMismatch, pActor->GetChannelId());
					m_unverifiedList[i] = m_unverifiedList[nNumUnverifiedHits-1];
					m_unverifiedList.pop_back();
					nNumUnverifiedHits--;
					i--;
				}			
			}
		}
	}

	static const float kMaxTimeVerifiedKept = 7.5f;
	const float kDeleteVerifiedBeforeThis	= fCurrentTime - kMaxTimeVerifiedKept;

	//Iterate over shots and remove any that are too old
	TShotHitVerificationMap::iterator iter	= m_shotHitVerificationMap.begin();
	while(iter != m_shotHitVerificationMap.end())
	{
		if(iter->second.fTime < kDeleteVerifiedBeforeThis)
		{
			TShotHitVerificationMap::iterator eraseIter = iter++;
			m_shotHitVerificationMap.erase(eraseIter);			
		}
		else
		{
			iter++;
		}
	}
#endif
}
开发者ID:aronarts,项目名称:FireNET,代码行数:97,代码来源:GameRulesMPDamageHandling.cpp

示例4: 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;
					}
				}
			}
//.........这里部分代码省略.........
开发者ID:MrHankey,项目名称:Tanks,代码行数:101,代码来源:GameRulesHostMigration.cpp


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