本文整理汇总了C++中CTeamControlPointMaster::PointCanBeCapped方法的典型用法代码示例。如果您正苦于以下问题:C++ CTeamControlPointMaster::PointCanBeCapped方法的具体用法?C++ CTeamControlPointMaster::PointCanBeCapped怎么用?C++ CTeamControlPointMaster::PointCanBeCapped使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTeamControlPointMaster
的用法示例。
在下文中一共展示了CTeamControlPointMaster::PointCanBeCapped方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AreaTouch
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CTriggerAreaCapture::AreaTouch( CBaseEntity *pOther )
{
if ( !IsActive() )
return;
if ( !PassesTriggerFilters(pOther) )
return;
// Don't cap areas unless the round is running
if ( !TeamplayGameRules()->PointsMayBeCaptured() )
return;
Assert( m_iAreaIndex != -1 );
// dont touch for non-alive or non-players
if( !pOther->IsPlayer() || !pOther->IsAlive() )
return;
// make sure this point is in the round being played (if we're playing one)
CTeamControlPointMaster *pMaster = g_hControlPointMasters.Count() ? g_hControlPointMasters[0] : NULL;
if ( pMaster && m_hPoint )
{
if ( !pMaster->PointCanBeCapped( m_hPoint ) )
{
return;
}
}
if ( m_hPoint )
{
m_nOwningTeam = m_hPoint->GetOwner();
}
CBaseMultiplayerPlayer *pPlayer = ToBaseMultiplayerPlayer(pOther);
Assert( pPlayer );
if ( pPlayer->GetTeamNumber() != m_nOwningTeam )
{
if ( m_TeamData[ pPlayer->GetTeamNumber() ].bCanCap )
{
DisplayCapHintTo( pPlayer );
}
}
}
示例2: CaptureThink
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CTriggerAreaCapture::CaptureThink( void )
{
SetNextThink( gpGlobals->curtime + AREA_THINK_TIME );
// make sure this point is in the round being played (if we're playing one)
CTeamControlPointMaster *pMaster = g_hControlPointMasters.Count() ? g_hControlPointMasters[0] : NULL;
if ( pMaster && m_hPoint )
{
if ( !pMaster->PointCanBeCapped( m_hPoint ) )
{
return;
}
}
if ( !TeamplayGameRules()->PointsMayBeCaptured() )
{
// Points aren't allowed to be captured. If we were
// being captured, we need to clean up and reset.
if ( m_bCapturing )
{
BreakCapture( false );
UpdateNumPlayers();
}
return;
}
// go through our list of players
Assert( GetNumberOfTeams() <= MAX_CAPTURE_TEAMS );
int iNumPlayers[MAX_CAPTURE_TEAMS];
int iNumBlockablePlayers[MAX_CAPTURE_TEAMS]; // Players in the zone who can't cap, but can block / pause caps
CBaseMultiplayerPlayer *pFirstPlayerTouching[MAX_CAPTURE_TEAMS];
for ( int i = FIRST_GAME_TEAM; i < GetNumberOfTeams(); i++ )
{
iNumPlayers[i] = 0;
iNumBlockablePlayers[i] = 0;
pFirstPlayerTouching[i] = NULL;
}
// Loop through the entities we're touching, and find players
for ( int i = 0; i < m_hTouchingEntities.Count(); i++ )
{
CBaseEntity *ent = m_hTouchingEntities[i];
if ( ent && ent->IsPlayer() )
{
CBaseMultiplayerPlayer *pPlayer = ToBaseMultiplayerPlayer(ent);
if ( pPlayer->IsAlive() )
{
int iTeam = pPlayer->GetTeamNumber();
// If a team's not allowed to cap a point, don't count players in it at all
if ( !TeamplayGameRules()->TeamMayCapturePoint( iTeam, m_hPoint->GetPointIndex() ) )
continue;
if ( !TeamplayGameRules()->PlayerMayCapturePoint( pPlayer, m_hPoint->GetPointIndex() ) )
{
if ( TeamplayGameRules()->PlayerMayBlockPoint( pPlayer, m_hPoint->GetPointIndex() ) )
{
if ( iNumPlayers[iTeam] == 0 && iNumBlockablePlayers[iTeam] == 0 )
{
pFirstPlayerTouching[iTeam] = pPlayer;
}
iNumBlockablePlayers[iTeam] += TeamplayGameRules()->GetCaptureValueForPlayer( pPlayer );
}
continue;
}
if ( iTeam >= FIRST_GAME_TEAM )
{
if ( iNumPlayers[iTeam] == 0 && iNumBlockablePlayers[iTeam] == 0 )
{
pFirstPlayerTouching[iTeam] = pPlayer;
}
iNumPlayers[iTeam] += TeamplayGameRules()->GetCaptureValueForPlayer( pPlayer );
}
}
}
}
int iTeamsInZone = 0;
bool bUpdatePlayers = false;
m_nTeamInZone = TEAM_UNASSIGNED;
for ( int i = FIRST_GAME_TEAM; i < GetNumberOfTeams(); i++ )
{
iNumPlayers[i] *= mp_simulatemultiplecappers.GetInt();
if ( m_TeamData[i].iNumTouching != iNumPlayers[i] )
{
m_TeamData[i].iNumTouching = iNumPlayers[i];
bUpdatePlayers = true;
}
m_TeamData[i].iBlockedTouching = m_TeamData[i].iNumTouching;
if ( m_TeamData[i].iNumTouching )
{
iTeamsInZone++;
//.........这里部分代码省略.........