本文整理汇总了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();
}
示例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 );
}