本文整理汇总了C++中CGameRules::GetScoringModule方法的典型用法代码示例。如果您正苦于以下问题:C++ CGameRules::GetScoringModule方法的具体用法?C++ CGameRules::GetScoringModule怎么用?C++ CGameRules::GetScoringModule使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGameRules
的用法示例。
在下文中一共展示了CGameRules::GetScoringModule方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Update
//------------------------------------------------------------------------
void CGameRulesKingOfTheHillObjective::Update( float frameTime )
{
BaseType::Update(frameTime);
CGameRules *pGameRules = g_pGame->GetGameRules();
IGameRulesScoringModule *pScoringModule = pGameRules->GetScoringModule();
const int localTeamId = pGameRules->GetTeam(g_pGame->GetIGameFramework()->GetClientActorId());
for (int i = 0; i < HOLD_OBJECTIVE_MAX_ENTITIES; ++ i)
{
SHoldEntityDetails *pDetails = &m_entities[i];
if (!pDetails->m_id)
{
continue;
}
SKotHEntity *pKotHEntity = static_cast<SKotHEntity *>(pDetails->m_pAdditionalData);
CRY_ASSERT(pKotHEntity);
if (gEnv->bServer && pScoringModule)
{
#ifndef _RELEASE
if (g_pGameCVars->g_KingOfTheHillObjective_watchLvl)
{
IEntity *pEntity = gEnv->pEntitySystem->GetEntity(pDetails->m_id);
const char *pEntName = pEntity ? pEntity->GetName() : "<NULL>";
if (pDetails->m_controllingTeamId == CONTESTED_TEAM_ID)
{
CryWatch("KotH entity '%s' is contested", pEntName);
}
else if (pDetails->m_controllingTeamId == 0)
{
CryWatch("KotH entity '%s' has no players nearby", pEntName);
}
else
{
CryWatch("KotH entity '%s' controlled by team %i, scoreTimerLength='%.2f', timeSinceLastScore='%.2f'",
pEntName, pDetails->m_controllingTeamId, pKotHEntity->m_scoreTimerLength, pKotHEntity->m_timeSinceLastScore);
}
}
#endif
if (pKotHEntity->m_scoringTeamId)
{
const int teamIndex = pKotHEntity->m_scoringTeamId - 1;
CRY_ASSERT_MESSAGE(teamIndex >= 0 && teamIndex < NUM_TEAMS, "Update() scoringTeamId is out of range");
pKotHEntity->m_timeSinceLastScore += frameTime;
if (pKotHEntity->m_timeSinceLastScore >= pKotHEntity->m_scoreTimerLength)
{
pScoringModule->OnTeamScoringEvent(teamIndex + 1, EGRST_KingOfTheHillObjectiveHeld);
pKotHEntity->m_timeSinceLastScore = 0.f;
AwardPlayerPoints(&pDetails->m_insideEntities[teamIndex], EGRST_KingOfTheHillObjectiveHeld);
CCCPOINT_IF((pKotHEntity->m_scoringTeamId == 1), KingOfTheHillObjective_TeamMarinesScored);
CCCPOINT_IF((pKotHEntity->m_scoringTeamId == 2), KingOfTheHillObjective_TeamCellScored);
}
}
}
if (gEnv->IsClient())
{
if (m_useIcons && pKotHEntity->m_needsIconUpdate)
{
UpdateIcon(pDetails);
}
if (pGameRules->GetGameMode() == eGM_CrashSite)
{
if (pDetails->m_localPlayerIsWithinRange && pDetails->m_controllingTeamId != CONTESTED_TEAM_ID)
{
CPersistantStats::GetInstance()->IncrementClientStats(EFPS_CrashSiteHeldTime, frameTime);
}
}
if (pKotHEntity->m_bPulseEnabled)
{
pKotHEntity->m_pulseTime -= frameTime;
if (pKotHEntity->m_pulseTime < 0.f)
{
eRadiusPulseType pulseType = GetPulseType(pDetails);
const float radiusEffectScale = pKotHEntity->m_radiusEffectScale * pDetails->m_controlRadius;
RadiusEffectPulse(pDetails->m_id, pulseType, radiusEffectScale);
pKotHEntity->m_pulseTime = m_pulseTimerLength;
}
}
else
{
if (!m_shouldDoPulseEffectFunc.empty())
{
IEntity *pEntity = gEnv->pEntitySystem->GetEntity(pDetails->m_id);
if (pEntity)
{
IScriptTable *pEntityScript = pEntity->GetScriptTable();
HSCRIPTFUNCTION pulseCheckFunc;
if (pEntityScript != NULL && pEntityScript->GetValue(m_shouldDoPulseEffectFunc.c_str(), pulseCheckFunc))
{
IScriptSystem *pScriptSystem = gEnv->pScriptSystem;
bool result = false;
//.........这里部分代码省略.........