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


C++ CBaseCombatCharacter::Weapon_Drop方法代码示例

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

示例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;
		}
	}
}
开发者ID:Orygin,项目名称:BisounoursParty,代码行数:34,代码来源:weapon_mine.cpp

示例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 );
	}
}
开发者ID:Bubbasacs,项目名称:FinalProj,代码行数:40,代码来源:hl2_triggers.cpp

示例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;

}
开发者ID:AluminumKen,项目名称:hl2sb-src,代码行数:25,代码来源:weapon_molotov.cpp

示例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 );
}
开发者ID:Rahmstein,项目名称:IOS,代码行数:25,代码来源:weapon_basesdkgrenade.cpp

示例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 );
	}
}
开发者ID:DreikVal,项目名称:nicksproject,代码行数:101,代码来源:weapon_slam.cpp


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