本文整理汇总了C++中CBaseTFPlayer::GetFlags方法的典型用法代码示例。如果您正苦于以下问题:C++ CBaseTFPlayer::GetFlags方法的具体用法?C++ CBaseTFPlayer::GetFlags怎么用?C++ CBaseTFPlayer::GetFlags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBaseTFPlayer
的用法示例。
在下文中一共展示了CBaseTFPlayer::GetFlags方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RecalculateAccuracy
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CWeaponCombatLaserRifle::RecalculateAccuracy( void )
{
CBaseTFPlayer *pPlayer = (CBaseTFPlayer*)GetOwner();
if (!pPlayer)
return;
m_flAccuracyTime += gpGlobals->frametime;
while ( m_flAccuracyTime > 0.05 )
{
if ( !(pPlayer->GetFlags() & FL_ONGROUND) )
{
m_flInaccuracy += 0.05;
}
else if ( pPlayer->GetFlags() & FL_DUCKING )
{
m_flInaccuracy -= 0.08;
}
/*
else if ( pPlayer->GetLocalVelocity().LengthSqr() > (100*100) )
{
// Never get worse than 1/2 accuracy from running
if ( m_flInaccuracy < 0.25 )
{
m_flInaccuracy += 0.01;
if ( m_flInaccuracy > 0.5 )
{
m_flInaccuracy = 0.5;
}
}
else if ( m_flInaccuracy > 0.25 )
{
m_flInaccuracy -= 0.01;
}
}
*/
else
{
m_flInaccuracy -= 0.04;
}
// Crouching prevents accuracy ever going beyond a point
if ( pPlayer->GetFlags() & FL_DUCKING )
{
m_flInaccuracy = clamp(m_flInaccuracy, 0, 0.8);
}
else
{
m_flInaccuracy = clamp(m_flInaccuracy, 0, 1);
}
m_flAccuracyTime -= 0.05;
#ifndef CLIENT_DLL
//if ( m_flInaccuracy )
//Msg("Inaccuracy %.2f (%.2f)\n", m_flInaccuracy, gpGlobals->curtime );
#endif
}
}
示例2: GetFireRate
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
float CWeaponCombatBurstRifle::GetFireRate( void )
{
if ( !inv_demo.GetFloat() )
{
float flFireRate = ( SequenceDuration() * 0.6f ) + SHARED_RANDOMFLOAT( 0.0, 0.035f );
CBaseTFPlayer *pPlayer = static_cast<CBaseTFPlayer*>( GetOwner() );
if ( pPlayer )
{
// Ducking players should fire more rapidly.
if ( pPlayer->GetFlags() & FL_DUCKING )
{
flFireRate *= weapon_combat_burstrifle_ducking_mod.GetFloat();
}
}
return flFireRate;
}
// Get the player and check to see if we are powered up.
CBaseTFPlayer *pPlayer = ( CBaseTFPlayer* )GetOwner();
if ( pPlayer && pPlayer->HasPowerup( POWERUP_BOOST ) )
{
return BURSTRIFLE_BOOSTED_FIRERATE;
}
return SHARED_RANDOMFLOAT( 0.075f, 0.15f );
}
示例3: Bot_RunAll
//-----------------------------------------------------------------------------
// Purpose: Run through all the Bots in the game and let them think.
//-----------------------------------------------------------------------------
void Bot_RunAll( void )
{
for ( int i = 1; i <= gpGlobals->maxClients; i++ )
{
CBaseTFPlayer *pPlayer = ToBaseTFPlayer( UTIL_PlayerByIndex( i ) );
if ( pPlayer && (pPlayer->GetFlags() & FL_FAKECLIENT) )
{
Bot_Think( pPlayer );
}
}
}
示例4: GetFireRate
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
float CWeaponCombatLaserRifle::GetFireRate( void )
{
float flFireRate = ( SequenceDuration() * 0.4 ) + SHARED_RANDOMFLOAT( 0.0, 0.035f );
CBaseTFPlayer *pPlayer = static_cast<CBaseTFPlayer*>( GetOwner() );
if ( pPlayer )
{
// Ducking players should fire more rapidly.
if ( pPlayer->GetFlags() & FL_DUCKING )
{
flFireRate *= weapon_combat_laserrifle_ducking_mod.GetFloat();
}
}
return flFireRate;
}