当前位置: 首页>>代码示例>>C++>>正文


C++ CBaseTFPlayer::GetFlags方法代码示例

本文整理汇总了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
	}
}
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:62,代码来源:weapon_combat_laserrifle.cpp

示例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 );
}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:31,代码来源:weapon_combat_burstrifle.cpp

示例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 );
		}
	}
}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:15,代码来源:bot_base.cpp

示例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;
}
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:19,代码来源:weapon_combat_laserrifle.cpp


注:本文中的CBaseTFPlayer::GetFlags方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。