本文整理汇总了C++中CBaseTFPlayer::AbortReload方法的典型用法代码示例。如果您正苦于以下问题:C++ CBaseTFPlayer::AbortReload方法的具体用法?C++ CBaseTFPlayer::AbortReload怎么用?C++ CBaseTFPlayer::AbortReload使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBaseTFPlayer
的用法示例。
在下文中一共展示了CBaseTFPlayer::AbortReload方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ShieldPostFrame
//-----------------------------------------------------------------------------
// Purpose: Handle the shield input
//-----------------------------------------------------------------------------
void CWeaponCombatShield::ShieldPostFrame( void )
{
CBaseTFPlayer *pOwner = ToBaseTFPlayer( GetOwner() );
if (!pOwner)
return;
UpdateShieldState();
CheckReload();
// Store off EMP state
bool isEMPed = IsOwnerEMPed();
// If the shield's unavailable, just abort
if ( GetShieldState() == SS_UNAVAILABLE )
return;
if ( m_flNextPrimaryAttack > gpGlobals->curtime )
return;
bool shieldRaised = ( GetShieldState() == SS_UP );
bool shieldRaising = ( GetShieldState() == SS_RAISING );
// GetShieldState() == SS_LOWERING );
// If my shield's out of power, I can't do anything with it
if ( !GetShieldHealth() )
return;
// Was the shield button just pressed?
if ( GetShieldState() == SS_DOWN && !isEMPed && pOwner->m_nButtons & IN_ATTACK2 )
{
// Play sound & anim
WeaponSound( SPECIAL1 );
SendWeaponAnim( ACT_VM_SECONDARYATTACK );
SetShieldState( SS_RAISING );
// Abort any reloads in progess
pOwner->AbortReload();
}
else if ( ( shieldRaised || shieldRaising ) && !FBitSet( pOwner->m_nButtons, IN_ATTACK2 ) )
{
// Shield button was just released, check to see if we were parrying
bool shouldParry = (gpGlobals->curtime < (m_flShieldUpStartTime + PARRY_DETECTION_TIME ));
if ( m_bHasShieldParry && shouldParry )
{
// Parry!
// Play sound & anim
WeaponSound( SPECIAL2 );
SendWeaponAnim( ACT_VM_SWINGHIT );
SetShieldState( SS_PARRYING );
// Bash enemies in front of me
ShieldBash();
}
else
{
// Player's just lowered his shield
// Play sound & anim
WeaponSound( SPECIAL2 );
SendWeaponAnim( ACT_VM_HAULBACK );
SetShieldState( SS_LOWERING );
m_flNextPrimaryAttack = gpGlobals->curtime + SequenceDuration();
}
}
else if ( GetShieldState() == SS_UP && ( pOwner->m_nButtons & IN_ATTACK2 ) && ( isEMPed ) )
{
// We've got our shield up, and we were just EMPed, so drop it
// Play sound & anim
SendWeaponAnim( ACT_VM_HAULBACK );
WeaponSound( SPECIAL2 );
SetShieldState( SS_LOWERING );
}
}