本文整理汇总了C++中CBaseCombatCharacter::Weapon_ShootPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ CBaseCombatCharacter::Weapon_ShootPosition方法的具体用法?C++ CBaseCombatCharacter::Weapon_ShootPosition怎么用?C++ CBaseCombatCharacter::Weapon_ShootPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBaseCombatCharacter
的用法示例。
在下文中一共展示了CBaseCombatCharacter::Weapon_ShootPosition方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CanAttachSLAM
//-----------------------------------------------------------------------------
// Purpose:
// Input :
// Output :
//-----------------------------------------------------------------------------
bool CWeapon_SLAM::CanAttachSLAM( void )
{
CBaseCombatCharacter *pOwner = GetOwner();
if (!pOwner)
{
return false;
}
Vector vecSrc = pOwner->Weapon_ShootPosition( );
Vector vecAiming = pOwner->BodyDirection2D( );
trace_t tr;
Vector vecEnd = vecSrc + (vecAiming * 42);
UTIL_TraceLine( vecSrc, vecEnd, MASK_SOLID, pOwner, COLLISION_GROUP_NONE, &tr );
if (tr.fraction < 1.0)
{
// Don't attach to a living creature
if (tr.m_pEnt)
{
CBaseEntity *pEntity = tr.m_pEnt;
CBaseCombatCharacter *pBCC = ToBaseCombatCharacter( pEntity );
if (pBCC)
{
return false;
}
}
return true;
}
else
{
return false;
}
}
示例2: StartSatchelAttach
//-----------------------------------------------------------------------------
// Purpose:
// Input :
// Output :
//-----------------------------------------------------------------------------
void CWeapon_SLAM::StartSatchelAttach( void )
{
#ifndef CLIENT_DLL
CBaseCombatCharacter *pOwner = GetOwner();
if (!pOwner)
{
return;
}
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))
{
// Only the player fires this way so we can cast
CBasePlayer *pPlayer = ToBasePlayer( pOwner );
// player "shoot" animation
pPlayer->SetAnimation( PLAYER_ATTACK1 );
//Tony; need to check the player models !
ToHL2MPPlayer(pPlayer)->DoAnimationEvent( PLAYERANIMEVENT_ATTACK_PRIMARY );
// -----------------------------------------
// Play attach animation
// -----------------------------------------
if (m_bDetonatorArmed)
{
SendWeaponAnim(ACT_SLAM_STICKWALL_ATTACH);
}
else
{
SendWeaponAnim(ACT_SLAM_STICKWALL_ND_ATTACH);
if (!m_bDetonatorArmed)
{
m_bDetonatorArmed = true;
m_bNeedDetonatorDraw = true;
}
}
m_bNeedReload = true;
m_bAttachSatchel = true;
m_flNextPrimaryAttack = m_flNextSecondaryAttack = SLAM_REFIRE_DELAY + gpGlobals->curtime + SequenceDuration();
}
}
#endif
}
示例3: 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 );
}
}
}
示例4: TripmineAttach
//-----------------------------------------------------------------------------
// Purpose:
// Input :
// Output :
//-----------------------------------------------------------------------------
void CWeapon_SLAM::TripmineAttach( void )
{
CBaseCombatCharacter *pOwner = GetOwner();
if (!pOwner)
{
return;
}
m_bAttachTripmine = false;
Vector vecSrc = pOwner->Weapon_ShootPosition();
Vector vecAiming = pOwner->EyeDirection3D();
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.x += 90;
CBaseEntity *pEnt = CBaseEntity::Create( "npc_tripmine", tr.endpos + tr.plane.normal * 3, angles, NULL );
CTripmineGrenade *pMine = (CTripmineGrenade *)pEnt;
pMine->m_hOwner = GetOwner();
pOwner->RemoveAmmo( 1, m_iSecondaryAmmoType );
EmitSound( "Weapon_SLAM.TripMineAttach" );
}
}
}
示例5: LaunchRocket
//-----------------------------------------------------------------------------
// Purpose: Launch a bounce/impact grenade
//-----------------------------------------------------------------------------
void CGEWeaponRocketLauncher::LaunchRocket( void )
{
CBaseCombatCharacter *pOwner = GetOwner();
if ( !pOwner )
return;
#ifndef CLIENT_DLL
Vector vForward, vRight, vUp;
AngleVectors( pOwner->EyeAngles(), &vForward, &vRight, &vUp );
// Manipulate the shoot position such that it is in front of our gun muzzle
Vector vecSrc = pOwner->Weapon_ShootPosition();
if ( pOwner->IsPlayer() )
{
VectorMA( vecSrc, 4.5f, vRight, vecSrc ); // 3.0, 5.0
VectorMA( vecSrc, 16.5f, vForward, vecSrc ); // 20, 19
VectorMA( vecSrc, -5.25f, vUp, vecSrc ); // -2, -6, -5, 5.25
}
else
{
VectorMA( vecSrc, 20.0, vForward, vecSrc );
}
CheckLaunchPosition( pOwner->EyePosition(), vecSrc );
if ( pOwner->MyNPCPointer() )
vForward = pOwner->MyNPCPointer()->GetActualShootTrajectory( vecSrc );
QAngle angAiming;
VectorAngles( vForward, angAiming );
// Convert us into a bot player :-D
if ( pOwner->IsNPC() )
{
CNPC_GEBase *pNPC = (CNPC_GEBase*) pOwner;
if ( pNPC->GetBotPlayer() )
pOwner = pNPC->GetBotPlayer();
}
CGERocket *pRocket = (CGERocket*)CBaseEntity::Create( "npc_rocket", vecSrc, angAiming, NULL );
if ( pRocket )
{
pRocket->SetThrower( pOwner );
pRocket->SetOwnerEntity( pOwner );
pRocket->SetSourceWeapon(this);
pRocket->SetDamage( GetGEWpnData().m_iDamage );
pRocket->SetDamageRadius( GetGEWpnData().m_flDamageRadius );
if (pOwner->GetTeamNumber() == TEAM_JANUS)
pRocket->SetCollisionGroup( COLLISION_GROUP_GRENADE_JANUS );
else if (pOwner->GetTeamNumber() == TEAM_MI6)
pRocket->SetCollisionGroup( COLLISION_GROUP_GRENADE_MI6 );
// Tell the owner what we threw to implement anti-spamming
if ( pOwner->IsPlayer() )
ToGEMPPlayer( pOwner )->AddThrownObject( pRocket );
}
#endif
// Remove the rocket from our ammo pool
m_iClip1 -= 1;
WeaponSound( SINGLE );
SwitchBodygroup(1, 1);
//Add our view kick in
AddViewKick();
}