本文整理汇总了C++中CBaseCombatCharacter::SwitchToNextBestWeapon方法的典型用法代码示例。如果您正苦于以下问题:C++ CBaseCombatCharacter::SwitchToNextBestWeapon方法的具体用法?C++ CBaseCombatCharacter::SwitchToNextBestWeapon怎么用?C++ CBaseCombatCharacter::SwitchToNextBestWeapon使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBaseCombatCharacter
的用法示例。
在下文中一共展示了CBaseCombatCharacter::SwitchToNextBestWeapon方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Weapon_Switch
//-----------------------------------------------------------------------------
// Purpose: Switch to next best weapon
// Input :
// Output :
//-----------------------------------------------------------------------------
void CWeapon_SLAM::Weapon_Switch( void )
{
// Note that we may pick the SLAM again, when we switch
// weapons, in which case we have to save and restore the
// detonator armed state.
// The SLAMs may be about to blow up, but haven't done so yet
// and the deploy function will find the undetonated charges
// and we are armed
bool saveState = m_bDetonatorArmed;
CBaseCombatCharacter *pOwner = GetOwner();
pOwner->SwitchToNextBestWeapon( pOwner->GetActiveWeapon() );
if (pOwner->GetActiveWeapon() == this)
{
m_bDetonatorArmed = saveState;
}
#ifndef CLIENT_DLL
// If not armed and have no ammo
if (!m_bDetonatorArmed && pOwner->GetAmmoCount(m_iSecondaryAmmoType) <= 0)
{
pOwner->ClearActiveWeapon();
}
#endif
}
示例2: WeaponSwitch
void CWeapon_Manhack::WeaponSwitch( void )
{
CBaseCombatCharacter *pOwner = GetOwner();
if (pOwner==NULL) return;
pOwner->SwitchToNextBestWeapon( pOwner->GetActiveWeapon() );
if (CPropVehicleManhack::GetManhackVehicle() == NULL && pOwner->GetAmmoCount(m_iPrimaryAmmoType) <= 0)
{
pOwner->ClearActiveWeapon();
}
}