本文整理汇总了C++中CTeamControlPointMaster::WouldNewCPOwnerWinGame方法的典型用法代码示例。如果您正苦于以下问题:C++ CTeamControlPointMaster::WouldNewCPOwnerWinGame方法的具体用法?C++ CTeamControlPointMaster::WouldNewCPOwnerWinGame怎么用?C++ CTeamControlPointMaster::WouldNewCPOwnerWinGame使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTeamControlPointMaster
的用法示例。
在下文中一共展示了CTeamControlPointMaster::WouldNewCPOwnerWinGame方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleScoring
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CTeamControlPoint::HandleScoring( int iTeam )
{
if ( TeamplayRoundBasedRules() && !TeamplayRoundBasedRules()->ShouldScorePerRound() )
{
GetGlobalTeam( iTeam )->AddScore( 1 );
TeamplayRoundBasedRules()->HandleTeamScoreModify( iTeam, 1 );
CTeamControlPointMaster *pMaster = g_hControlPointMasters.Count() ? g_hControlPointMasters[0] : NULL;
if ( pMaster && !pMaster->WouldNewCPOwnerWinGame( this, iTeam ) )
{
#ifdef TF_DLL
if ( TeamplayRoundBasedRules()->GetGameType() == TF_GAMETYPE_ESCORT )
{
CBroadcastRecipientFilter filter;
EmitSound( filter, entindex(), "Hud.EndRoundScored" );
}
else
#endif
{
CTeamRecipientFilter filter( iTeam );
EmitSound( filter, entindex(), "Hud.EndRoundScored" );
}
}
}
}
示例2: WatcherThink
//.........这里部分代码省略.........
m_flTrainDistanceFromStart = m_flTotalPathDistance - flDistanceToGoal;
// play alert sounds if necessary
for ( int iCount = 0 ; iCount < m_iNumCPLinks ; iCount++ )
{
if ( m_flTrainDistanceFromStart < m_CPLinks[iCount].flDistanceFromStart - TEAM_TRAIN_ALERT_DISTANCE )
{
// back up twice the alert distance before resetting our flag to play the warning again
if ( ( m_flTrainDistanceFromStart < m_CPLinks[iCount].flDistanceFromStart - ( TEAM_TRAIN_ALERT_DISTANCE * 2 ) ) || // has receded back twice the alert distance or...
( !m_bTrainCanRecede ) ) // used to catch the case where the train doesn't normally recede but has rolled back down a hill away from the CP
{
// reset our alert flag
m_CPLinks[iCount].bAlertPlayed = false;
}
}
else
{
if ( m_flTrainDistanceFromStart < m_CPLinks[iCount].flDistanceFromStart && !m_CPLinks[iCount].bAlertPlayed )
{
m_CPLinks[iCount].bAlertPlayed = true;
bool bFinalPointInMap = false;
CTeamControlPoint *pCurrentPoint = m_CPLinks[iCount].hCP.Get();
CTeamControlPointMaster *pMaster = g_hControlPointMasters.Count() ? g_hControlPointMasters[0] : NULL;
if ( pMaster )
{
// if we're not playing mini-rounds
if ( !pMaster->PlayingMiniRounds() )
{
for ( int i = FIRST_GAME_TEAM ; i < MAX_CONTROL_POINT_TEAMS ; i++ )
{
if ( ObjectiveResource() && ObjectiveResource()->TeamCanCapPoint( pCurrentPoint->GetPointIndex(), i ) )
{
if ( pMaster->WouldNewCPOwnerWinGame( pCurrentPoint, i ) )
{
bFinalPointInMap = true;
}
}
}
}
else
{
// or this is the last round
if ( pMaster->NumPlayableControlPointRounds() == 1 )
{
CTeamControlPointRound *pRound = pMaster->GetCurrentRound();
if ( pRound )
{
for ( int i = FIRST_GAME_TEAM ; i < MAX_CONTROL_POINT_TEAMS ; i++ )
{
if ( ObjectiveResource() && ObjectiveResource()->TeamCanCapPoint( pCurrentPoint->GetPointIndex(), i ) )
{
if ( pRound->WouldNewCPOwnerWinGame( pCurrentPoint, i ) )
{
bFinalPointInMap = true;
}
}
}
}
}
}
}
PlayCaptureAlert( pCurrentPoint, bFinalPointInMap );
}
}