本文整理汇总了C++中CBaseCombatWeapon::SetTouch方法的典型用法代码示例。如果您正苦于以下问题:C++ CBaseCombatWeapon::SetTouch方法的具体用法?C++ CBaseCombatWeapon::SetTouch怎么用?C++ CBaseCombatWeapon::SetTouch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBaseCombatWeapon
的用法示例。
在下文中一共展示了CBaseCombatWeapon::SetTouch方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Drop
//DHL - Skillet - Fix ammo exploits
void CWeaponFrag::Drop( const Vector &vecVelocity )
{
if ( !HasPrimaryAmmo() )
{
//BaseClass::Drop( vecVelocity );
SUB_Remove();
return;
}
if ( !GetOwner() )
return;
DecrementAmmo( GetOwner() );
Reload(); //Do draw animation and stuff
#ifndef CLIENT_DLL
CBasePlayer *owner = ToBasePlayer(GetOwner());
Vector vThrowPos = owner->Weapon_ShootPosition() - Vector(0,0,12);
//Create a grenade
CBaseCombatWeapon* pGrenade;
pGrenade = (CBaseCombatWeapon *)CBaseEntity::Create( "weapon_frag", vThrowPos, vec3_angle, NULL );
if ( !pGrenade )
return;
pGrenade->SetRemoveable( true );
//If it was dropped then there's no need to respawn it.
pGrenade->AddSpawnFlags( SF_NORESPAWN );
pGrenade->StopAnimation();
pGrenade->StopFollowingEntity( );
pGrenade->SetMoveType( MOVETYPE_FLYGRAVITY );
// clear follow stuff, setup for collision
pGrenade->SetGravity(1.0);
pGrenade->m_iState = WEAPON_NOT_CARRIED;
pGrenade->RemoveEffects( EF_NODRAW );
pGrenade->FallInit();
pGrenade->SetGroundEntity( NULL );
pGrenade->SetTouch(NULL);
pGrenade->SetOwnerEntity( NULL );
pGrenade->SetOwner( NULL );
//Toss it in the direction of the player's view
Vector vecNewVelocity;
Vector vecDir;
owner->EyeVectors( &vecDir );
vecNewVelocity = ( vecDir * 500.0f );
IPhysicsObject *pObj = pGrenade->VPhysicsGetObject();
if ( pObj != NULL )
{
AngularImpulse angImp( 200, 200, 200 );
pObj->AddVelocity( &vecNewVelocity, &angImp );
}
#endif
}