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


C++ CBaseCombatWeapon::Spawn方法代码示例

本文整理汇总了C++中CBaseCombatWeapon::Spawn方法的典型用法代码示例。如果您正苦于以下问题:C++ CBaseCombatWeapon::Spawn方法的具体用法?C++ CBaseCombatWeapon::Spawn怎么用?C++ CBaseCombatWeapon::Spawn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CBaseCombatWeapon的用法示例。


在下文中一共展示了CBaseCombatWeapon::Spawn方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Spawn

void CJaS_Marine_Jack::Spawn()
{
	CASW_Marine_Resource *pResource = dynamic_cast<CASW_Marine_Resource *>( CreateEntityByName( "asw_marine_resource" ) );
	pResource->SetProfileIndex( 6 );
	pResource->SetMarineEntity( this );
	SetMarineResource( pResource );
	pResource->Spawn();
	m_pProfileOverride = pResource->GetProfile();
	SelectModelFromProfile();
	SetModelFromProfile();

	CBaseCombatWeapon *pWeapon = dynamic_cast<CBaseCombatWeapon *>( CreateEntityByName( "asw_weapon_sniper_rifle" ) );
	if ( pWeapon )
	{
		pWeapon->Spawn();
		pWeapon->GiveDefaultAmmo();
		pWeapon->m_iClip1 = 9999;
		GiveAmmo(9999, pWeapon->GetPrimaryAmmoType());
		Weapon_Equip_In_Index( pWeapon, 0 );
		Weapon_Switch( pWeapon );
	}
	m_bConstantSlowHeal = true;

	m_hSquadFormation = static_cast<CASW_SquadFormation *>( CreateEntityByName( "asw_squadformation" ) );
	m_hSquadFormation->Leader( this );

	SetRenderColor( 0x99, 0x40, 0x40 );

	BaseClass::Spawn();
}
开发者ID:Nightgunner5,项目名称:Jastian-Summer,代码行数:30,代码来源:jas_marine_jack.cpp

示例2: HandleAnimEvent

//-----------------------------------------------------------------------------
// Purpose: Catches the monster-specific messages that occur when tagged
//			animation frames are played.
// Input  : *pEvent - 
//-----------------------------------------------------------------------------
void CItem_AmmoCrate::HandleAnimEvent( animevent_t *pEvent )
{
	if ( pEvent->event == AE_AMMOCRATE_PICKUP_AMMO )
	{
		if ( m_hActivator )
		{
			if ( m_pGiveWeapon[m_nAmmoType] && !m_hActivator->Weapon_OwnsThisType( m_pGiveWeapon[m_nAmmoType] ) )
			{
				CBaseEntity *pEntity = CreateEntityByName( m_pGiveWeapon[m_nAmmoType] );
				CBaseCombatWeapon *pWeapon = dynamic_cast<CBaseCombatWeapon*>(pEntity);
				if ( pWeapon )
				{
					pWeapon->SetAbsOrigin( m_hActivator->GetAbsOrigin() );
					pWeapon->m_iPrimaryAmmoType = 0;
					pWeapon->m_iSecondaryAmmoType = 0;
					pWeapon->Spawn();
					if ( !m_hActivator->BumpWeapon( pWeapon ) )
					{
						UTIL_Remove( pEntity );
					}
					else
					{
						SetBodygroup( 1, false );
					}
				}
			}

			if ( m_hActivator->GiveAmmo( m_nAmmoAmounts[m_nAmmoType], m_nAmmoIndex ) != 0 )
			{
				SetBodygroup( 1, false );
			}
			m_hActivator = NULL;
		}
		return;
	}

	BaseClass::HandleAnimEvent( pEvent );
}
开发者ID:SteamLUG,项目名称:steamlug-7dfps-2013,代码行数:43,代码来源:item_ammo.cpp


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