本文整理汇总了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;
}
示例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;
}
示例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() );
}
}
}
}
}