本文整理汇总了C++中CTeamControlPointMaster::GetPartialCapturePointRate方法的典型用法代码示例。如果您正苦于以下问题:C++ CTeamControlPointMaster::GetPartialCapturePointRate方法的具体用法?C++ CTeamControlPointMaster::GetPartialCapturePointRate怎么用?C++ CTeamControlPointMaster::GetPartialCapturePointRate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTeamControlPointMaster
的用法示例。
在下文中一共展示了CTeamControlPointMaster::GetPartialCapturePointRate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: StartTouch
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CTriggerAreaCapture::StartTouch(CBaseEntity *pOther)
{
BaseClass::StartTouch( pOther );
if ( PassesTriggerFilters(pOther) && m_hPoint )
{
m_nOwningTeam = m_hPoint->GetOwner();
IGameEvent *event = gameeventmanager->CreateEvent( "controlpoint_starttouch" );
if ( event )
{
event->SetInt( "player", pOther->entindex() );
event->SetInt( "area", m_hPoint->GetPointIndex() );
gameeventmanager->FireEvent( event );
}
// Call capture think immediately to make it update our area's player counts.
// If we don't do this, the player can receive the above event telling him he's
// in a zone, but the objective resource still thinks he's not.
m_bStartTouch = true;
CaptureThink();
m_bStartTouch = false;
if ( m_bCapturing )
{
CTeamControlPointMaster *pMaster = g_hControlPointMasters.Count() ? g_hControlPointMasters[0] : NULL;
if ( pMaster )
{
float flRate = pMaster->GetPartialCapturePointRate();
if ( flRate > 0.0f )
{
CBaseMultiplayerPlayer *pPlayer = ToBaseMultiplayerPlayer(pOther);
if ( pPlayer && pPlayer->GetTeamNumber() == m_nCapturingTeam )
{
pPlayer->StartScoringEscortPoints( flRate );
}
}
}
}
}
}
示例2: StartCapture
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CTriggerAreaCapture::StartCapture( int team, int capmode )
{
// Remap team to get first game team = 1
switch ( team - FIRST_GAME_TEAM+1 )
{
case 1:
m_OnStartTeam1.FireOutput( this, this );
break;
case 2:
m_OnStartTeam2.FireOutput( this, this );
break;
default:
Assert(0);
break;
}
m_StartOutput.FireOutput(this,this);
m_nCapturingTeam = team;
UpdateNumPlayers();
if ( CaptureModeScalesWithPlayers() )
{
SetCapTimeRemaining( ((m_flCapTime * 2) * m_TeamData[team].iNumRequiredToCap) );
}
else
{
SetCapTimeRemaining( m_flCapTime );
}
m_bCapturing = true;
m_bBlocked = false;
m_iCapMode = capmode;
m_flLastReductionTime = gpGlobals->curtime;
UpdateCappingTeam( m_nCapturingTeam );
UpdateBlocked();
if( m_hPoint )
{
int numcappers = 0;
int cappingplayers[MAX_AREA_CAPPERS];
GetNumCappingPlayers( m_nCapturingTeam, numcappers, cappingplayers );
m_hPoint->CaptureStart( m_nCapturingTeam, numcappers, cappingplayers );
}
// tell all touching players to start racking up capture points
CTeamControlPointMaster *pMaster = g_hControlPointMasters.Count() ? g_hControlPointMasters[0] : NULL;
if ( pMaster )
{
float flRate = pMaster->GetPartialCapturePointRate();
if ( flRate > 0.0f )
{
// for each player touch
CTeam *pTeam = GetGlobalTeam( m_nCapturingTeam );
if ( pTeam )
{
for ( int i=0;i<pTeam->GetNumPlayers();i++ )
{
CBaseMultiplayerPlayer *pPlayer = ToBaseMultiplayerPlayer( pTeam->GetPlayer(i) );
if ( pPlayer && IsTouching( pPlayer ) )
{
pPlayer->StartScoringEscortPoints( flRate );
}
}
}
}
}
}