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


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

本文整理汇总了C++中CBaseTFPlayer::EyePosition方法的典型用法代码示例。如果您正苦于以下问题:C++ CBaseTFPlayer::EyePosition方法的具体用法?C++ CBaseTFPlayer::EyePosition怎么用?C++ CBaseTFPlayer::EyePosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CBaseTFPlayer的用法示例。


在下文中一共展示了CBaseTFPlayer::EyePosition方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: PrimaryAttack

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CWeaponCombatPlasmaGrenadeLauncher::PrimaryAttack( void )
{
	CBaseTFPlayer *pPlayer = (CBaseTFPlayer*)GetOwner();
	if (!pPlayer)
		return;
	
	WeaponSound(SINGLE);

	// Fire the bullets
	Vector vecSrc = pPlayer->Weapon_ShootPosition( );

	PlayAttackAnimation( GetPrimaryAttackActivity() );

	// Launch the grenade
	Vector vecForward;
	pPlayer->EyeVectors( &vecForward );
	Vector vecOrigin = pPlayer->EyePosition();
	vecOrigin += (vecForward);

#if !defined( CLIENT_DLL )
	float flSpeed = 1200;

	CGrenadeAntiPersonnel* pGrenade = CGrenadeAntiPersonnel::Create(vecOrigin, vecForward * flSpeed, pPlayer );
	pGrenade->SetModel( "models/weapons/w_grenade.mdl" );
	pGrenade->SetBounceSound( "PlasmaGrenade.Bounce" );
	pGrenade->SetDamage( weapon_combat_plasmagrenadelauncher_damage.GetFloat() );
	pGrenade->SetDamageRadius( weapon_combat_plasmagrenadelauncher_radius.GetFloat() );
	pGrenade->SetExplodeOnContact( true );
#endif

	m_flNextPrimaryAttack = gpGlobals->curtime + GetFireRate();
	m_iClip1 = m_iClip1 - 1;
}
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:36,代码来源:weapon_combat_plasma_grenade_launcher.cpp

示例2: FireBullets

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CWeaponPlasmaRifle::FireBullets( CBaseTFCombatWeapon *pWeapon, int cShots, const Vector &vecSrc, const Vector &vecDirShooting, const Vector &vecSpread, float flDistance, int iBulletType, int iTracerFreq )
{
	CBaseTFPlayer *pPlayer = static_cast< CBaseTFPlayer * >( GetOwner() );
	if ( !pPlayer )
		return;

	Vector vecForward;
	pPlayer->EyeVectors( &vecForward );
	Vector vecOrigin = pPlayer->EyePosition();
	trace_t tr;

	Vector vecTracerSrc = pWeapon->GetTracerSrc( (Vector&)vecSrc, (Vector&)vecDirShooting );

	// Fire the emp projectile
	CBasePlasmaProjectile *pPlasma = CBasePlasmaProjectile::Create( vecTracerSrc, vecDirShooting, DMG_ENERGYBEAM, pPlayer );
	pPlasma->SetDamage( weapon_plasmarifle_damage.GetFloat() );
	pPlasma->m_hOwner = pPlayer;
}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:21,代码来源:weapon_plasmarifle.cpp

示例3: StartAdrenalinRush

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CPlayerClassCommando::StartAdrenalinRush( void )
{
	// Am I actually alive?
	if ( !m_pPlayer->IsAlive() )
		return;

	// Do I have rush capability?
	if ( !m_bCanRush )
		return;

	m_bPersonalRush = true;

	// Start adrenalin rushing
	m_pPlayer->AttemptToPowerup( POWERUP_RUSH, class_commando_rush_length.GetFloat() );

	// If I have battlecry, adrenalin up all my nearby teammates
	if ( m_bHasBattlecry )
	{
		// Find nearby teammates
		for ( int i = 0; i < m_pPlayer->GetTFTeam()->GetNumPlayers(); i++ )
		{
			CBaseTFPlayer *pPlayer = (CBaseTFPlayer *)m_pPlayer->GetTFTeam()->GetPlayer(i);
			assert(pPlayer);

			// Is it within range?
			if ( pPlayer != m_pPlayer && (pPlayer->GetAbsOrigin() - m_pPlayer->GetAbsOrigin()).Length() < class_commando_battlecry_radius.GetFloat() )
			{
				// Can I see it?
				trace_t tr;
				UTIL_TraceLine( m_pPlayer->EyePosition(), pPlayer->EyePosition(), MASK_SOLID_BRUSHONLY, m_pPlayer, COLLISION_GROUP_NONE, &tr);
				CBaseEntity *pEntity = tr.m_pEnt;
				if ( (tr.fraction == 1.0) || ( pEntity == pPlayer ) )
				{
					pPlayer->AttemptToPowerup( POWERUP_RUSH, class_commando_battlecry_length.GetFloat() );
				}
			}
		}
	}
}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:42,代码来源:tf_class_commando.cpp


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