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


C++ CGameRules::GetServerTime方法代码示例

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


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

示例1: Update

//------------------------------------------------------------------------
void CGameRulesHoldObjectiveBase::Update( float frameTime )
{
	if (m_bHasNetSerialized && !gEnv->bServer)
	{
		for (int i = 0; i < HOLD_OBJECTIVE_MAX_ENTITIES; ++ i)
		{
			SHoldEntityDetails *pDetails = &m_entities[i];

			int oldControllingTeamId = pDetails->m_controllingTeamId;
			int oldTeam1Count = pDetails->m_insideCount[0];
			int oldTeam2Count = pDetails->m_insideCount[1];

			int team1Count = pDetails->m_serializedInsideCount[0];
			int team2Count = pDetails->m_serializedInsideCount[1];

			DetermineControllingTeamId(pDetails, team1Count, team2Count);

			if ((oldTeam1Count != team1Count) || (oldTeam2Count != team2Count))
			{
				pDetails->m_insideCount[0] = team1Count;
				pDetails->m_insideCount[1] = team2Count;

				if (pDetails->m_id)
				{
					OnInsideStateChanged(pDetails);

					if (oldControllingTeamId != pDetails->m_controllingTeamId)
					{
						OnControllingTeamChanged(pDetails, oldControllingTeamId);
					}
				}
			}
		}

		m_bHasNetSerialized = false;
	}

	EntityId localPlayerId = g_pGame->GetIGameFramework()->GetClientActorId();

	for (int i = 0; i < HOLD_OBJECTIVE_MAX_ENTITIES; ++ i)
	{
		SHoldEntityDetails *pDetails = &m_entities[i];

#ifndef _RELEASE
		DebugDrawCylinder(pDetails);
#endif

		if (pDetails->m_id && pDetails->m_totalInsideBoxCount)
		{
			CheckCylinder(pDetails, localPlayerId);
		}
		else if (pDetails->m_pendingId)
		{
			DoAddEntityId(1, pDetails->m_pendingId, i, pDetails->m_isNewEntity);
			pDetails->m_pendingId = 0;
			pDetails->m_isNewEntity = false;
		}
	}

	UpdateEffect(frameTime);

	if (m_pStartingAnimSequence && gEnv->pMovieSystem)
	{
		m_deferredTrackViewTime -= frameTime;
		if (m_deferredTrackViewTime < 0.f)
		{
			CGameRules *pGameRules = g_pGame->GetGameRules();
			const float currentTime = (pGameRules->GetServerTime() * 0.001f);
			const float timeStarted = m_pendingTimeAdded.GetSeconds();

			const float timeSinceStarted = currentTime - timeStarted;

			const float playingTime = gEnv->pMovieSystem->GetPlayingTime(m_pStartingAnimSequence);

			CryLog("CGameRulesHoldObjectiveBase::Update() anim sequence %s at %f seconds (should be at least %f)", m_pStartingAnimSequence->GetName(), playingTime, timeSinceStarted);
			if (playingTime < timeSinceStarted)
			{
				gEnv->pMovieSystem->SetPlayingTime(m_pStartingAnimSequence, timeSinceStarted);
			}
			m_pStartingAnimSequence = NULL;
		}
	}
}
开发者ID:aronarts,项目名称:FireNET,代码行数:84,代码来源:GameRulesHoldObjectiveBase.cpp


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