本文整理汇总了C++中C_TFPlayer::GetActiveTFWeapon方法的典型用法代码示例。如果您正苦于以下问题:C++ C_TFPlayer::GetActiveTFWeapon方法的具体用法?C++ C_TFPlayer::GetActiveTFWeapon怎么用?C++ C_TFPlayer::GetActiveTFWeapon使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类C_TFPlayer
的用法示例。
在下文中一共展示了C_TFPlayer::GetActiveTFWeapon方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ShouldDraw
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
bool CHudDemomanChargeMeter::ShouldDraw( void )
{
C_TFPlayer *pPlayer = C_TFPlayer::GetLocalTFPlayer();
if ( !pPlayer || !pPlayer->IsPlayerClass( TF_CLASS_DEMOMAN ) || !pPlayer->IsAlive() )
{
return false;
}
CTFWeaponBase *pWpn = pPlayer->GetActiveTFWeapon();
if ( !pWpn )
{
return false;
}
int iWeaponID = pWpn->GetWeaponID();
if ( iWeaponID != TF_WEAPON_PIPEBOMBLAUNCHER )
{
return false;
}
return CHudElement::ShouldDraw();
}
示例2: OnTick
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CHudDemomanChargeMeter::OnTick( void )
{
C_TFPlayer *pPlayer = C_TFPlayer::GetLocalTFPlayer();
if ( !pPlayer )
return;
CTFWeaponBase *pWpn = pPlayer->GetActiveTFWeapon();
ITFChargeUpWeapon *pChargeupWeapon = dynamic_cast< ITFChargeUpWeapon *>( pWpn );
if ( !pWpn || !pChargeupWeapon )
return;
if ( m_pChargeMeter )
{
float flChargeMaxTime = pChargeupWeapon->GetChargeMaxTime();
if ( flChargeMaxTime != 0 )
{
float flChargeBeginTime = pChargeupWeapon->GetChargeBeginTime();
if ( flChargeBeginTime > 0 )
{
float flTimeCharged = max( 0, gpGlobals->curtime - flChargeBeginTime );
float flPercentCharged = min( 1.0, flTimeCharged / flChargeMaxTime );
m_pChargeMeter->SetProgress( flPercentCharged );
}
else
{
m_pChargeMeter->SetProgress( 0.0f );
}
}
}
}
示例3: OnBind
void CProxySniperRifleCharge::OnBind( void *pC_BaseEntity )
{
Assert( m_pResult );
C_TFPlayer *pPlayer = C_TFPlayer::GetLocalTFPlayer();
if ( GetSpectatorTarget() != 0 && GetSpectatorMode() == OBS_MODE_IN_EYE )
{
pPlayer = (C_TFPlayer *)UTIL_PlayerByIndex( GetSpectatorTarget() );
}
if ( pPlayer )
{
CTFSniperRifle *pWeapon = assert_cast<CTFSniperRifle*>(pPlayer->GetActiveTFWeapon());
if ( pWeapon )
{
float flChargeValue = ( ( 1.0 - pWeapon->GetHUDDamagePerc() ) * 0.8 ) + 0.6;
VMatrix mat, temp;
Vector2D center( 0.5, 0.5 );
MatrixBuildTranslation( mat, -center.x, -center.y, 0.0f );
// scale
{
Vector2D scale( 1.0f, 0.25f );
MatrixBuildScale( temp, scale.x, scale.y, 1.0f );
MatrixMultiply( temp, mat, mat );
}
MatrixBuildTranslation( temp, center.x, center.y, 0.0f );
MatrixMultiply( temp, mat, mat );
// translation
{
Vector2D translation( 0.0f, flChargeValue );
MatrixBuildTranslation( temp, translation.x, translation.y, 0.0f );
MatrixMultiply( temp, mat, mat );
}
m_pResult->SetMatrixValue( mat );
}
}
if ( ToolsEnabled() )
{
ToolFramework_RecordMaterialParams( GetMaterial() );
}
}
示例4: OnTick
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CHudMedicChargeMeter::OnTick( void )
{
C_TFPlayer *pPlayer = C_TFPlayer::GetLocalTFPlayer();
if ( !pPlayer )
return;
CTFWeaponBase *pWpn = pPlayer->GetActiveTFWeapon();
if ( !pWpn || ( pWpn->GetWeaponID() != TF_WEAPON_MEDIGUN ) )
return;
CWeaponMedigun *pMedigun = static_cast< CWeaponMedigun *>( pWpn );
if ( !pMedigun )
return;
float flCharge = pMedigun->GetChargeLevel();
if ( flCharge != m_flLastChargeValue )
{
if ( m_pChargeMeter )
{
m_pChargeMeter->SetProgress( flCharge );
}
if ( !m_bCharged )
{
if ( flCharge >= 1.0 )
{
g_pClientMode->GetViewportAnimationController()->StartAnimationSequence( this, "HudMedicCharged" );
m_bCharged = true;
}
}
else
{
// we've got invuln charge or we're using our invuln
if ( !pMedigun->IsReleasingCharge() )
{
g_pClientMode->GetViewportAnimationController()->StartAnimationSequence( this, "HudMedicChargedStop" );
m_bCharged = false;
}
}
}
m_flLastChargeValue = flCharge;
}
示例5: ShouldDraw
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
bool CHudMedicChargeMeter::ShouldDraw( void )
{
C_TFPlayer *pPlayer = C_TFPlayer::GetLocalTFPlayer();
if ( !pPlayer || !pPlayer->IsPlayerClass( TF_CLASS_MEDIC ) || !pPlayer->IsAlive() )
{
return false;
}
CTFWeaponBase *pWpn = pPlayer->GetActiveTFWeapon();
if ( !pWpn )
{
return false;
}
if ( pWpn->GetWeaponID() != TF_WEAPON_MEDIGUN )
{
return false;
}
return CHudElement::ShouldDraw();
}
示例6: ShouldDraw
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
bool CTFHudWeaponAmmo::ShouldDraw( void )
{
// Get the player and active weapon.
C_TFPlayer *pPlayer = C_TFPlayer::GetLocalTFPlayer();
if ( !pPlayer )
{
return false;
}
CTFWeaponBase *pWeapon = pPlayer->GetActiveTFWeapon();
if ( !pWeapon )
{
return false;
}
if ( pWeapon->GetWeaponID() == TF_WEAPON_MEDIGUN )
{
return false;
}
return CHudElement::ShouldDraw();
}
示例7: FX_FireBullets
//.........这里部分代码省略.........
#endif
// Fire bullets, calculate impacts & effects.
StartGroupingSounds();
#if !defined (CLIENT_DLL)
// Move other players back to history positions based on local player's lag
lagcompensation->StartLagCompensation( pPlayer, pPlayer->GetCurrentCommand() );
#endif
// Get the shooting angles.
Vector vecShootForward, vecShootRight, vecShootUp;
AngleVectors( vecAngles, &vecShootForward, &vecShootRight, &vecShootUp );
// Initialize the static firing information.
FireBulletsInfo_t fireInfo;
fireInfo.m_vecSrc = vecOrigin;
if ( flDamage < 0.0f )
{
fireInfo.m_flDamage = pWeaponInfo->GetWeaponData( iMode ).m_nDamage;
}
else
{
fireInfo.m_flDamage = static_cast<int>(flDamage);
}
fireInfo.m_flDistance = pWeaponInfo->GetWeaponData( iMode ).m_flRange;
fireInfo.m_iShots = 1;
fireInfo.m_vecSpread.Init( flSpread, flSpread, 0.0f );
fireInfo.m_iAmmoType = pWeaponInfo->iAmmoType;
// Setup the bullet damage type & roll for crit.
int nDamageType = DMG_GENERIC;
int nCustomDamageType = TF_DMG_CUSTOM_NONE;
CTFWeaponBase *pWeapon = pPlayer->GetActiveTFWeapon();
if ( pWeapon )
{
nDamageType = pWeapon->GetDamageType();
if ( pWeapon->IsCurrentAttackACrit() || bCritical )
{
nDamageType |= DMG_CRITICAL;
}
nCustomDamageType = pWeapon->GetCustomDamageType();
}
if ( iWeapon != TF_WEAPON_MINIGUN )
{
fireInfo.m_iTracerFreq = 2;
}
// Reset multi-damage structures.
ClearMultiDamage();
int nBulletsPerShot = pWeaponInfo->GetWeaponData( iMode ).m_nBulletsPerShot;
for ( int iBullet = 0; iBullet < nBulletsPerShot; ++iBullet )
{
// Initialize random system with this seed.
RandomSeed( iSeed );
// Determine if the first bullet should be perfectly accurate.
bool bPerfectAccuracy = false;
if ( pWeapon && iBullet == 0 )
{
float flFireInterval = gpGlobals->curtime - pWeapon->GetLastFireTime();
if ( nBulletsPerShot == 1 )