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


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

本文整理汇总了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 );
	}
}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:81,代码来源:weapon_combatshield.cpp


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