本文整理汇总了C++中CBaseMultiplayerPlayer::SpeakConceptIfAllowed方法的典型用法代码示例。如果您正苦于以下问题:C++ CBaseMultiplayerPlayer::SpeakConceptIfAllowed方法的具体用法?C++ CBaseMultiplayerPlayer::SpeakConceptIfAllowed怎么用?C++ CBaseMultiplayerPlayer::SpeakConceptIfAllowed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBaseMultiplayerPlayer
的用法示例。
在下文中一共展示了CBaseMultiplayerPlayer::SpeakConceptIfAllowed方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HaveAllPlayersSpeakConceptIfAllowed
void CMultiplayRules::HaveAllPlayersSpeakConceptIfAllowed( int iConcept )
{
CBaseMultiplayerPlayer *pPlayer;
for ( int i = 1; i <= gpGlobals->maxClients; i++ )
{
pPlayer = ToBaseMultiplayerPlayer( UTIL_PlayerByIndex( i ) );
if ( !pPlayer )
continue;
pPlayer->SpeakConceptIfAllowed( iConcept );
}
}
示例2: InternalSetOwner
//-----------------------------------------------------------------------------
// Purpose: Sets the new owner of the point, plays the appropriate sound and shows the right model
//-----------------------------------------------------------------------------
void CTeamControlPoint::InternalSetOwner( int iCapTeam, bool bMakeSound, int iNumCappers, int *pCappingPlayers )
{
Assert( iCapTeam >= 0 && iCapTeam < GetNumberOfTeams() );
int iOldTeam = m_iTeam;
m_iTeam = iCapTeam;
ChangeTeam( iCapTeam );
if ( bMakeSound )
{
CBroadcastRecipientFilter filter;
EmitSound( filter, entindex(), STRING( m_TeamData[m_iTeam].iszCapSound ) );
}
// Update visuals
SetModel( STRING(m_TeamData[m_iTeam].iszModel) );
SetBodygroup( 0, m_iTeam );
m_nSkin = ( m_iTeam == TEAM_UNASSIGNED ) ? 2 : (m_iTeam - 2);
ResetSequence( LookupSequence("idle") );
// We add 1 to the index because we consider the default "no points capped" as 0.
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:
//.........这里部分代码省略.........
示例3: WatcherThink
void CTeamTrainWatcher::WatcherThink( void )
{
if ( m_bWaitingToRecede )
{
if ( m_flRecedeTime < gpGlobals->curtime )
{
m_bWaitingToRecede = false;
// don't actually recede in overtime
if ( TeamplayRoundBasedRules() && !TeamplayRoundBasedRules()->InOvertime() )
{
// fire recede output
m_OnTrainStartRecede.FireOutput( this, this );
HandleTrainMovement( true );
}
}
}
bool bDisableAlarm = (TeamplayRoundBasedRules() && TeamplayRoundBasedRules()->State_Get() != GR_STATE_RND_RUNNING);
if ( bDisableAlarm )
{
StopCaptureAlarm();
}
// given its next node, we can walk the nodes and find the linear
// distance to the next cp node, or to the goal node
CFuncTrackTrain *pTrain = m_hTrain;
if ( pTrain )
{
int iOldTrainSpeedLevel = m_iTrainSpeedLevel;
// how fast is the train moving?
float flSpeed = pTrain->GetDesiredSpeed();
// divide speed into regions
// anything negative is -1
if ( flSpeed < 0 )
{
m_iTrainSpeedLevel = -1;
// even though our desired speed might be negative,
// our actual speed might be zero if we're at a dead end...
// this will turn off the < image when the train is done moving backwards
if ( pTrain->GetCurrentSpeed() == 0 )
{
m_iTrainSpeedLevel = 0;
}
}
else if ( flSpeed > m_flSpeedLevels[2] )
{
m_iTrainSpeedLevel = 3;
}
else if ( flSpeed > m_flSpeedLevels[1] )
{
m_iTrainSpeedLevel = 2;
}
else if ( flSpeed > m_flSpeedLevels[0] )
{
m_iTrainSpeedLevel = 1;
}
else
{
m_iTrainSpeedLevel = 0;
}
if ( m_iTrainSpeedLevel != iOldTrainSpeedLevel )
{
// make sure the sparks are off if we're not moving backwards anymore
if ( m_bHandleTrainMovement )
{
if ( m_iTrainSpeedLevel == 0 && iOldTrainSpeedLevel != 0 )
{
HandleSparks( false );
}
}
// play any concepts that we might need to play
if ( TeamplayRoundBasedRules() )
{
if ( m_iTrainSpeedLevel == 0 && iOldTrainSpeedLevel != 0 )
{
TeamplayRoundBasedRules()->HaveAllPlayersSpeakConceptIfAllowed( MP_CONCEPT_CART_STOP );
m_flNextSpeakForwardConceptTime = 0;
}
else if ( m_iTrainSpeedLevel < 0 && iOldTrainSpeedLevel == 0 )
{
TeamplayRoundBasedRules()->HaveAllPlayersSpeakConceptIfAllowed( MP_CONCEPT_CART_MOVING_BACKWARD );
m_flNextSpeakForwardConceptTime = 0;
}
}
}
if ( m_iTrainSpeedLevel > 0 && m_flNextSpeakForwardConceptTime < gpGlobals->curtime )
{
if ( m_hAreaCap.Get() )
{
for ( int i = 1; i <= gpGlobals->maxClients; i++ )
{
//.........这里部分代码省略.........