本文整理汇总了C++中CBaseCombatCharacter::Weapon_Drop方法的典型用法代码示例。如果您正苦于以下问题:C++ CBaseCombatCharacter::Weapon_Drop方法的具体用法?C++ CBaseCombatCharacter::Weapon_Drop怎么用?C++ CBaseCombatCharacter::Weapon_Drop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBaseCombatCharacter
的用法示例。
在下文中一共展示了CBaseCombatCharacter::Weapon_Drop方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WeaponIdle
//-----------------------------------------------------------------------------
// Purpose:
// Input :
// Output :
//-----------------------------------------------------------------------------
void CWeapon_Tripwire::WeaponIdle( void )
{
// Ready to switch animations?
if ( HasWeaponIdleTimeElapsed() )
{
if (m_bClearReload)
{
m_bNeedReload = false;
m_bClearReload = false;
}
CBaseCombatCharacter *pOwner = GetOwner();
if (!pOwner)
{
return;
}
int iAnim = 0;
if (m_bAttachTripwire)
{
TripwireAttach();
iAnim = ACT_SLAM_TRIPMINE_ATTACH2;
}
else if (m_bNeedReload)
{
// If owner had ammo draw the correct tripwire type
if (pOwner->GetAmmoCount(m_iSecondaryAmmoType) > 0)
{
iAnim = ACT_SLAM_TRIPMINE_DRAW;
m_bClearReload = true;
}
else
{
pOwner->Weapon_Drop( this );
UTIL_Remove(this);
}
}
else if (pOwner->GetAmmoCount(m_iSecondaryAmmoType) <= 0)
{
pOwner->Weapon_Drop( this );
UTIL_Remove(this);
}
// If I don't need to reload just do the appropriate idle
else
{
iAnim = ACT_SLAM_TRIPMINE_IDLE;
}
SendWeaponAnim( iAnim );
}
}
示例2: WeaponIdle
void CWeaponMine::WeaponIdle( void )
{
if(gpGlobals->curtime > m_flNextPrimaryAttack){
CBaseCombatCharacter *pOwner = GetOwner();
if (!pOwner)
return;
//Si on a une mine à finir de poser
if(m_bAttachMine)
FinishAttach();
//Sinon si on doit recharger
if( m_bNeedReload )
{
if (pOwner->GetAmmoCount(m_iSecondaryAmmoType) > 0){
SendWeaponAnim(ACT_SLAM_TRIPMINE_DRAW);
m_bNeedReload = false;
}
#ifndef CLIENT_DLL
//Sinon on a pas assez de munitions et on drop l'arme
else
{
pOwner->Weapon_Drop(this);
UTIL_Remove(this);
}
#endif
}
//Sinon on idle
else
{
SendWeaponAnim(ACT_SLAM_TRIPMINE_IDLE);
m_flWallSwitchTime = 0;
}
}
}
示例3: StartTouch
//-----------------------------------------------------------------------------
// Drops all weapons, marks the character as not being able to pick up weapons
//-----------------------------------------------------------------------------
void CTriggerWeaponStrip::StartTouch(CBaseEntity *pOther)
{
BaseClass::StartTouch( pOther );
if ( PassesTriggerFilters(pOther) == false )
return;
CBaseCombatCharacter *pCharacter = pOther->MyCombatCharacterPointer();
if ( m_bKillWeapons )
{
for ( int i = 0 ; i < pCharacter->WeaponCount(); ++i )
{
CBaseCombatWeapon *pWeapon = pCharacter->GetWeapon( i );
if ( !pWeapon )
continue;
pCharacter->Weapon_Drop( pWeapon );
UTIL_Remove( pWeapon );
}
return;
}
// Strip the player of his weapons
if ( pCharacter && !pCharacter->IsEFlagSet( EFL_NO_WEAPON_PICKUP ) )
{
CBaseCombatWeapon *pBugbait = pCharacter->Weapon_OwnsThisType( "weapon_bugbait" );
if ( pBugbait )
{
pCharacter->Weapon_Drop( pBugbait );
UTIL_Remove( pBugbait );
}
pCharacter->Weapon_DropAll( true );
pCharacter->AddEFlags( EFL_NO_WEAPON_PICKUP );
}
}
示例4: DrawAmmo
//-----------------------------------------------------------------------------
// Purpose:
//
//
//-----------------------------------------------------------------------------
void CWeaponMolotov::DrawAmmo( void )
{
// -------------------------------------------
// Make sure I have ammo of the current type
// -------------------------------------------
CBaseCombatCharacter *pOwner = GetOwner();
if (pOwner->GetAmmoCount(m_iSecondaryAmmoType) <=0)
{
pOwner->Weapon_Drop( this );
UTIL_Remove(this);
return;
}
Msg("Drawing Molotov...\n");
m_bNeedDraw = false;
//<<TEMP>> - till real animation is avaible
m_flNextPrimaryAttack = gpGlobals->curtime + 2.0;
m_flNextSecondaryAttack = gpGlobals->curtime + 2.0;
}
示例5: Holster
//-----------------------------------------------------------------------------
// Purpose:
// Output : Returns true on success, false on failure.
//-----------------------------------------------------------------------------
bool CBaseSDKGrenade::Holster( CBaseCombatWeapon *pSwitchingTo )
{
m_bRedraw = false;
m_bPinPulled = false; // when this is holstered make sure the pin isn’t pulled.
m_fThrowTime = 0;
#ifndef CLIENT_DLL
// If they attempt to switch weapons before the throw animation is done,
// allow it, but kill the weapon if we have to.
CSDKPlayer *pPlayer = GetPlayerOwner();
if( pPlayer->GetAmmoCount(m_iPrimaryAmmoType) <= 0 )
{
CBaseCombatCharacter *pOwner = (CBaseCombatCharacter *)pPlayer;
pOwner->Weapon_Drop( this );
UTIL_Remove(this);
}
#endif
return BaseClass::Holster( pSwitchingTo );
}
示例6: WeaponIdle
//.........这里部分代码省略.........
case SLAM_SATCHEL_ATTACH:
{
if (m_bNeedDetonatorHolster)
{
iAnim = ACT_SLAM_STICKWALL_DETONATOR_HOLSTER;
m_bNeedDetonatorHolster = false;
}
else if (m_bDetonatorArmed)
{
iAnim = m_bNeedDetonatorDraw ? ACT_SLAM_DETONATOR_STICKWALL_DRAW : ACT_SLAM_STICKWALL_DRAW;
m_bNeedDetonatorDraw = false;
}
else
{
iAnim = ACT_SLAM_STICKWALL_ND_DRAW;
}
}
break;
case SLAM_SATCHEL_THROW:
{
if (m_bNeedDetonatorHolster)
{
iAnim = ACT_SLAM_THROW_DETONATOR_HOLSTER;
m_bNeedDetonatorHolster = false;
}
else if (m_bDetonatorArmed)
{
iAnim = m_bNeedDetonatorDraw ? ACT_SLAM_DETONATOR_THROW_DRAW : ACT_SLAM_THROW_DRAW;
m_bNeedDetonatorDraw = false;
}
else
{
iAnim = ACT_SLAM_THROW_ND_DRAW;
}
}
break;
}
m_bClearReload = true;
}
// If no ammo and armed, idle with only the detonator
else if (m_bDetonatorArmed)
{
iAnim = m_bNeedDetonatorDraw ? ACT_SLAM_DETONATOR_DRAW : ACT_SLAM_DETONATOR_IDLE;
m_bNeedDetonatorDraw = false;
}
else
{
pOwner->Weapon_Drop( this );
UTIL_Remove(this);
}
}
else if (pOwner->GetAmmoCount(m_iSecondaryAmmoType) <= 0)
{
pOwner->Weapon_Drop( this );
UTIL_Remove(this);
}
// If I don't need to reload just do the appropriate idle
else
{
switch( m_tSlamState)
{
case SLAM_TRIPMINE_READY:
{
iAnim = ACT_SLAM_TRIPMINE_IDLE;
}
break;
case SLAM_SATCHEL_THROW:
{
if (m_bNeedDetonatorHolster)
{
iAnim = ACT_SLAM_THROW_DETONATOR_HOLSTER;
m_bNeedDetonatorHolster = false;
}
else
{
iAnim = m_bDetonatorArmed ? ACT_SLAM_THROW_IDLE : ACT_SLAM_THROW_ND_IDLE;
m_flWallSwitchTime = 0;
}
}
break;
case SLAM_SATCHEL_ATTACH:
{
if (m_bNeedDetonatorHolster)
{
iAnim = ACT_SLAM_STICKWALL_DETONATOR_HOLSTER;
m_bNeedDetonatorHolster = false;
}
else
{
iAnim = m_bDetonatorArmed ? ACT_SLAM_STICKWALL_IDLE : ACT_SLAM_STICKWALL_ND_IDLE;
m_flWallSwitchTime = 0;
}
}
break;
}
}
SendWeaponAnim( iAnim );
}
}