本文整理汇总了C++中CTeamControlPointMaster::IsActive方法的典型用法代码示例。如果您正苦于以下问题:C++ CTeamControlPointMaster::IsActive方法的具体用法?C++ CTeamControlPointMaster::IsActive怎么用?C++ CTeamControlPointMaster::IsActive使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTeamControlPointMaster
的用法示例。
在下文中一共展示了CTeamControlPointMaster::IsActive方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CaptureStart
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CTeamControlPoint::CaptureStart( int iCapTeam, int iNumCappingPlayers, int *pCappingPlayers )
{
int iNumCappers = iNumCappingPlayers;
float flLastOwnershipChangeTime = -1.f;
CBaseEntity *pEnt = gEntList.FindEntityByClassname( NULL, GetControlPointMasterName() );
while( pEnt )
{
CTeamControlPointMaster *pMaster = dynamic_cast<CTeamControlPointMaster *>( pEnt );
if ( pMaster && pMaster->IsActive() )
{
flLastOwnershipChangeTime = pMaster->GetLastOwnershipChangeTime();
}
pEnt = gEntList.FindEntityByClassname( pEnt, GetControlPointMasterName() );
}
IGameEvent *event = gameeventmanager->CreateEvent( "teamplay_point_startcapture" );
if ( event )
{
event->SetInt( "cp", m_iPointIndex );
event->SetString( "cpname", STRING( m_iszPrintName ) );
event->SetInt( "team", m_iTeam );
event->SetInt( "capteam", iCapTeam );
event->SetFloat( "captime", gpGlobals->curtime - flLastOwnershipChangeTime );
// safety check
if ( iNumCappers > 8 )
{
iNumCappers = 8;
}
char cappers[9]; // pCappingPlayers should be max length 8
int i;
for( i = 0 ; i < iNumCappers ; i++ )
{
cappers[i] = (char)pCappingPlayers[i];
}
cappers[i] = '\0';
// pCappingPlayers is a null terminated list of player indices
event->SetString( "cappers", cappers );
event->SetInt( "priority", 7 );
gameeventmanager->FireEvent( event );
}
}
示例2: InternalSetOwner
//.........这里部分代码省略.........
TeamplayGameRules()->SetLastCapPointChanged( m_iPointIndex+1 );
// Determine the pose parameters for each team
for ( int i = 0; i < m_TeamData.Count(); i++ )
{
// Skip spectator
if ( i == TEAM_SPECTATOR )
continue;
if ( GetModelPtr() && GetModelPtr()->SequencesAvailable() )
{
m_TeamData[i].iTeamPoseParam = LookupPoseParameter( UTIL_VarArgs( "cappoint_%d_percentage", i ) );
}
else
{
m_TeamData[i].iTeamPoseParam = -1;
}
}
UpdateCapPercentage();
if ( m_iTeam == TEAM_UNASSIGNED )
{
m_OnCapReset.FireOutput( this, this );
}
else
{
// Remap team to get first game team = 1
switch ( m_iTeam - FIRST_GAME_TEAM+1 )
{
case 1:
m_OnCapTeam1.FireOutput( this, this );
break;
case 2:
m_OnCapTeam2.FireOutput( this, this );
break;
default:
Assert(0);
break;
}
}
// If we're playing a sound, this is a true cap by players.
if ( bMakeSound )
{
if ( iOldTeam > LAST_SHARED_TEAM && iOldTeam != m_iTeam )
{
// Make the members of our old team say something
for ( int i = 1; i <= gpGlobals->maxClients; i++ )
{
CBaseMultiplayerPlayer *pPlayer = ToBaseMultiplayerPlayer( UTIL_PlayerByIndex( i ) );
if ( !pPlayer )
continue;
if ( pPlayer->GetTeamNumber() == iOldTeam )
{
pPlayer->SpeakConceptIfAllowed( MP_CONCEPT_LOST_CONTROL_POINT );
}
}
}
for( int i = 0; i < iNumCappers; i++ )
{
int playerIndex = pCappingPlayers[i];
Assert( playerIndex > 0 && playerIndex <= gpGlobals->maxClients );
PlayerCapped( ToBaseMultiplayerPlayer(UTIL_PlayerByIndex( playerIndex )) );
}
// Remap team to get first game team = 1
switch ( m_iTeam - FIRST_GAME_TEAM+1 )
{
case 1:
m_OnOwnerChangedToTeam1.FireOutput( this, this );
break;
case 2:
m_OnOwnerChangedToTeam2.FireOutput( this, this );
break;
}
if ( m_iTeam != TEAM_UNASSIGNED && iNumCappers )
{
SendCapString( m_iTeam, iNumCappers, pCappingPlayers );
}
}
// Have control point master check the win conditions now!
CBaseEntity *pEnt = gEntList.FindEntityByClassname( NULL, GetControlPointMasterName() );
while( pEnt )
{
CTeamControlPointMaster *pMaster = dynamic_cast<CTeamControlPointMaster *>( pEnt );
if ( pMaster->IsActive() )
{
pMaster->CheckWinConditions();
}
pEnt = gEntList.FindEntityByClassname( pEnt, GetControlPointMasterName() );
}
}