本文整理汇总了C++中CSatchelCharge::SetThrower方法的典型用法代码示例。如果您正苦于以下问题:C++ CSatchelCharge::SetThrower方法的具体用法?C++ CSatchelCharge::SetThrower怎么用?C++ CSatchelCharge::SetThrower使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSatchelCharge
的用法示例。
在下文中一共展示了CSatchelCharge::SetThrower方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SatchelAttach
//-----------------------------------------------------------------------------
// Purpose:
// Input :
// Output :
//-----------------------------------------------------------------------------
void CWeapon_SLAM::SatchelAttach( void )
{
CBaseCombatCharacter *pOwner = GetOwner();
if (!pOwner)
{
return;
}
m_bAttachSatchel = false;
Vector vecSrc = pOwner->Weapon_ShootPosition( );
Vector vecAiming = pOwner->BodyDirection2D( );
trace_t tr;
UTIL_TraceLine( vecSrc, vecSrc + (vecAiming * 128), MASK_SOLID, pOwner, COLLISION_GROUP_NONE, &tr );
if (tr.fraction < 1.0)
{
CBaseEntity *pEntity = tr.m_pEnt;
if (pEntity && !(pEntity->GetFlags() & FL_CONVEYOR))
{
QAngle angles;
VectorAngles(tr.plane.normal, angles);
angles.y -= 90;
angles.z -= 90;
tr.endpos.z -= 6.0f;
EmitSound( "Weapon_SLAM.SatchelAttach" );
CSatchelCharge *pSatchel = (CSatchelCharge*)CBaseEntity::Create( "npc_satchel", tr.endpos + tr.plane.normal * 3, angles, NULL );
pSatchel->SetMoveType( MOVETYPE_FLY ); // no gravity
pSatchel->m_bIsAttached = true;
pSatchel->m_bIsLive = true;
pSatchel->SetThrower( GetOwner() );
pSatchel->SetOwnerEntity( ((CBaseEntity*)GetOwner()) );
pSatchel->m_pMyWeaponSLAM = this;
pOwner->RemoveAmmo( 1, m_iSecondaryAmmoType );
}
}
}
示例2: SatchelThrow
//-----------------------------------------------------------------------------
// Purpose:
// Input :
// Output :
//-----------------------------------------------------------------------------
void CWeapon_SLAM::SatchelThrow( void )
{
m_bThrowSatchel = false;
// Only the player fires this way so we can cast
CBasePlayer *pPlayer = ToBasePlayer( GetOwner() );
Vector vecSrc = pPlayer->WorldSpaceCenter();
Vector vecFacing = pPlayer->BodyDirection3D( );
vecSrc = vecSrc + vecFacing * 18.0;
// BUGBUG: is this because vecSrc is not from Weapon_ShootPosition()???
vecSrc.z += 24.0f;
Vector vecThrow;
GetOwner()->GetVelocity( &vecThrow, NULL );
vecThrow += vecFacing * 500;
// Player may have turned to face a wall during the throw anim in which case
// we don't want to throw the SLAM into the wall
if (CanAttachSLAM())
{
vecThrow = vecFacing;
vecSrc = pPlayer->WorldSpaceCenter() + vecFacing * 5.0;
}
CSatchelCharge *pSatchel = (CSatchelCharge*)Create( "npc_satchel", vecSrc, vec3_angle, GetOwner() );
pSatchel->SetThrower( GetOwner() );
pSatchel->ApplyAbsVelocityImpulse( vecThrow );
pSatchel->SetLocalAngularVelocity( QAngle( 0, 400, 0 ) );
pSatchel->m_bIsLive = true;
pSatchel->m_pMyWeaponSLAM = this;
pPlayer->RemoveAmmo( 1, m_iSecondaryAmmoType );
// Play throw sound
EmitSound( "Weapon_SLAM.SatchelThrow" );
}