本文整理汇总了C++中CASW_Player::IsConnected方法的典型用法代码示例。如果您正苦于以下问题:C++ CASW_Player::IsConnected方法的具体用法?C++ CASW_Player::IsConnected怎么用?C++ CASW_Player::IsConnected使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CASW_Player
的用法示例。
在下文中一共展示了CASW_Player::IsConnected方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Flick
//------------------------------------------------------------------------------
// Purpose:
// Input :
// Output :
//------------------------------------------------------------------------------
void CAI_ASW_FlickBehavior::Flick( )
{
#if 0
for( int i = 0; i < ASWDirector()->GetNPCListCount(); i++ )
{
CASW_Alien *pAlien = ASWDirector()->GetNPCFromList( i );
if ( !pAlien || !pAlien->IsAlive() )
{
continue;
}
if ( GetOuter() != pAlien )
{
TryFlicking( pAlien );
}
}
for ( int i = 0; i < ASW_MAX_READY_PLAYERS; i++ )
{
// found a connected player?
CASW_Player *pOtherPlayer = dynamic_cast< CASW_Player * >( UTIL_PlayerByIndex( i + 1 ) );
// if they're not connected, skip them
if ( !pOtherPlayer || !pOtherPlayer->IsConnected() )
{
continue;
}
TryFlicking( pOtherPlayer );
}
#else
AIEnemiesIter_t iter;
for( AI_EnemyInfo_t *pEMemory = GetEnemies()->GetFirst( &iter ); pEMemory != NULL; pEMemory = GetEnemies()->GetNext( &iter ) )
{
CBaseEntity *pEntity = pEMemory->hEnemy;
if ( pEntity->IsAlive() && GetOuter() != pEntity )
{
TryFlicking( pEntity );
}
}
#endif
// turn this into an area of affect
// reverse his velocity - if he is coming towards the shield bug, add that back into his outgoing to increase it
}
示例2: RemoveAMarine
// unselects a single marine
// tries to pick the player with the most marines selected
void CASW_Game_Resource::RemoveAMarine()
{
int iHighest = 0;
CASW_Player *pChosen = NULL;
for ( int i = 1; i <= gpGlobals->maxClients; i++ )
{
CASW_Player* pOtherPlayer = dynamic_cast<CASW_Player*>(UTIL_PlayerByIndex(i));
if ( pOtherPlayer && pOtherPlayer->IsConnected() )
{
int iMarines = GetNumMarines(pOtherPlayer);
if (iHighest == 0 || iMarines > iHighest)
{
iHighest = iMarines;
pChosen = pOtherPlayer;
}
}
}
RemoveAMarineFor(pChosen);
}
示例3: SetHackProgress
void CASW_Button_Area::SetHackProgress(float f, CASW_Marine *pMarine)
{
CBaseEntity *pActor = pMarine;
if ( !pActor )
{
pActor = this;
}
if (m_fHackProgress <= 0 && f > 0 && m_fStartedHackTime == 0)
{
m_fStartedHackTime = gpGlobals->curtime;
}
if (m_fHackProgress < 0.25f && f >= 0.25f)
{
m_OnButtonHackAt25Percent.FireOutput(pActor, this);
}
if (m_fHackProgress < 0.5f && f >= 0.5f)
{
m_OnButtonHackAt50Percent.FireOutput(pActor, this);
pMarine->GetMarineSpeech()->Chatter(CHATTER_HACK_HALFWAY);
}
if (m_fHackProgress < 0.75f && f >= 0.75f)
{
m_OnButtonHackAt75Percent.FireOutput(pActor, this);
}
if (m_fHackProgress < 1.0f && f >= 1.0f)
{
if ( asw_simple_hacking.GetBool() )
{
pMarine->StopUsing();
}
float time_taken = gpGlobals->curtime - m_fStartedHackTime;
// decide if this was a fast hack or not
float fSpeedScale = 1.0f;
if (pMarine)
fSpeedScale *= MarineSkills()->GetSkillBasedValueByMarine(pMarine, ASW_MARINE_SKILL_HACKING, ASW_MARINE_SUBSKILL_HACKING_SPEED_SCALE);
float ideal_time = UTIL_ASW_CalcFastDoorHackTime(m_iWireRows, m_iWireColumns, m_iNumWires, m_iHackLevel, fSpeedScale);
bool bFastHack = time_taken <= ideal_time;
if (asw_debug_medals.GetBool())
{
Msg("Finished door hack, fast = %d.\n", bFastHack);
Msg(" ideal time is %f you took %f\n", ideal_time, time_taken);
}
if (bFastHack && pMarine && pMarine->GetMarineResource())
{
pMarine->GetMarineResource()->m_iFastDoorHacks++;
if ( pMarine->IsInhabited() && pMarine->GetCommander() )
{
pMarine->GetCommander()->AwardAchievement( ACHIEVEMENT_ASW_FAST_WIRE_HACKS );
}
}
if ( GetCurrentHack() )
{
GetCurrentHack()->OnHackComplete();
}
if ( pMarine->GetMarineResource() && pMarine->GetMarineResource()->m_iDamageTakenDuringHack <= 0 )
{
int nAliensKilled = ASWGameResource() ? ASWGameResource()->GetAliensKilledInThisMission() : 0;
if ( ( nAliensKilled - m_iAliensKilledBeforeHack ) > 10 )
{
for ( int i = 1; i <= gpGlobals->maxClients; i++ )
{
CASW_Player *pPlayer = dynamic_cast<CASW_Player*>( UTIL_PlayerByIndex( i ) );
if ( !pPlayer || !pPlayer->IsConnected() || !pPlayer->GetMarine() || pPlayer->GetMarine() == pMarine )
continue;
if ( pPlayer->GetMarine()->GetMarineResource() )
{
pPlayer->GetMarine()->GetMarineResource()->m_bProtectedTech = true;
}
pPlayer->AwardAchievement( ACHIEVEMENT_ASW_PROTECT_TECH );
}
}
}
// unlock it
m_OnButtonHackCompleted.FireOutput(pActor, this);
m_bIsLocked = false;
UpdateWaitingForInput();
UpdatePanelSkin();
EmitSound("ASWComputer.HackComplete");
if ( pMarine && bFastHack )
{
pMarine->GetMarineSpeech()->QueueChatter(CHATTER_HACK_BUTTON_FINISHED, gpGlobals->curtime + 2.0f, gpGlobals->curtime + 3.0f);
}
// if set to use on unlock, then do so
if ( m_bUseAfterHack && pMarine )
{
ActivateUnlockedButton(pMarine);
}
if ( pMarine && !pMarine->IsInhabited() )
{
//.........这里部分代码省略.........