本文整理汇总了C++中CAI_BaseNPC::GetActualShootTrajectory方法的典型用法代码示例。如果您正苦于以下问题:C++ CAI_BaseNPC::GetActualShootTrajectory方法的具体用法?C++ CAI_BaseNPC::GetActualShootTrajectory怎么用?C++ CAI_BaseNPC::GetActualShootTrajectory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAI_BaseNPC
的用法示例。
在下文中一共展示了CAI_BaseNPC::GetActualShootTrajectory方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Operator_HandleAnimEvent
//-----------------------------------------------------------------------------
// Purpose:
// Input : *pEvent -
// *pOperator -
//-----------------------------------------------------------------------------
void CWeaponSniperRifle::Operator_HandleAnimEvent( animevent_t *pEvent, CBaseCombatCharacter *pOperator )
{
switch ( pEvent->event )
{
case EVENT_WEAPON_SNIPER_RIFLE_FIRE:
{
Vector vecShootOrigin, vecShootDir;
vecShootOrigin = pOperator->Weapon_ShootPosition();
CAI_BaseNPC *npc = pOperator->MyNPCPointer();
Vector vecSpread;
if (npc)
{
vecShootDir = npc->GetActualShootTrajectory( vecShootOrigin );
vecSpread = VECTOR_CONE_PRECALCULATED;
}
else
{
AngleVectors( pOperator->GetLocalAngles(), &vecShootDir );
vecSpread = GetBulletSpread();
}
WeaponSound( SINGLE_NPC );
pOperator->FireBullets( SNIPER_BULLET_COUNT_NPC, vecShootOrigin, vecShootDir, vecSpread, MAX_TRACE_LENGTH, m_iPrimaryAmmoType, SNIPER_TRACER_FREQUENCY_NPC );
pOperator->DoMuzzleFlash();
break;
}
default:
{
BaseClass::Operator_HandleAnimEvent( pEvent, pOperator );
break;
}
}
}
示例2: Operator_HandleAnimEvent
//-----------------------------------------------------------------------------
// Purpose:
// Input :
// Output :
//-----------------------------------------------------------------------------
void CWeaponPistol::Operator_HandleAnimEvent( animevent_t *pEvent, CBaseCombatCharacter *pOperator )
{
switch( pEvent->event )
{
case EVENT_WEAPON_PISTOL_FIRE:
{
Vector vecShootOrigin, vecShootDir;
vecShootOrigin = pOperator->Weapon_ShootPosition();
CAI_BaseNPC *npc = pOperator->MyNPCPointer();
ASSERT( npc != NULL );
vecShootDir = npc->GetActualShootTrajectory( vecShootOrigin );
CSoundEnt::InsertSound( SOUND_COMBAT|SOUND_CONTEXT_GUNFIRE, pOperator->GetAbsOrigin(), SOUNDENT_VOLUME_PISTOL, 0.2, pOperator, SOUNDENT_CHANNEL_WEAPON, pOperator->GetEnemy() );
WeaponSound( SINGLE_NPC );
pOperator->FireBullets( 1, vecShootOrigin, vecShootDir, VECTOR_CONE_PRECALCULATED, MAX_TRACE_LENGTH, m_iPrimaryAmmoType, 2 );
pOperator->DoMuzzleFlash();
m_iClip1 = m_iClip1 - 1;
}
break;
default:
BaseClass::Operator_HandleAnimEvent( pEvent, pOperator );
break;
}
}
示例3: LookupAttachment
//-----------------------------------------------------------------------------
// Purpose:
// Input : *pOperator -
//-----------------------------------------------------------------------------
void CWeaponAR2::FireNPCPrimaryAttack( CBaseCombatCharacter *pOperator, bool bUseWeaponAngles )
{
Vector vecShootOrigin, vecShootDir;
CAI_BaseNPC *npc = pOperator->MyNPCPointer();
ASSERT( npc != NULL );
if ( bUseWeaponAngles )
{
QAngle angShootDir;
GetAttachment( LookupAttachment( "muzzle" ), vecShootOrigin, angShootDir );
AngleVectors( angShootDir, &vecShootDir );
}
else
{
vecShootOrigin = pOperator->Weapon_ShootPosition();
vecShootDir = npc->GetActualShootTrajectory( vecShootOrigin );
}
WeaponSoundRealtime( SINGLE_NPC );
CSoundEnt::InsertSound( SOUND_COMBAT|SOUND_CONTEXT_GUNFIRE, pOperator->GetAbsOrigin(), SOUNDENT_VOLUME_MACHINEGUN, 0.2, pOperator, SOUNDENT_CHANNEL_WEAPON, pOperator->GetEnemy() );
pOperator->FireBullets( 1, vecShootOrigin, vecShootDir, VECTOR_CONE_PRECALCULATED, MAX_TRACE_LENGTH, m_iPrimaryAmmoType, 2 );
// NOTENOTE: This is overriden on the client-side
// pOperator->DoMuzzleFlash();
m_iClip1 = m_iClip1 - 1;
}
示例4:
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CWeaponG43::Operator_HandleAnimEvent( animevent_t *pEvent, CBaseCombatCharacter *pOperator )
{
switch( pEvent->event )
{
case EVENT_WEAPON_SMG1:
{
Vector vecShootOrigin, vecShootDir;
QAngle angDiscard;
// Support old style attachment point firing
if ((pEvent->options == NULL) || (pEvent->options[0] == '\0') || (!pOperator->GetAttachment(pEvent->options, vecShootOrigin, angDiscard)))
{
vecShootOrigin = pOperator->Weapon_ShootPosition();
}
CAI_BaseNPC *npc = pOperator->MyNPCPointer();
ASSERT( npc != NULL );
vecShootDir = npc->GetActualShootTrajectory( vecShootOrigin );
FireNPCPrimaryAttack( pOperator, vecShootOrigin, vecShootDir );
}
break;
default:
BaseClass::Operator_HandleAnimEvent( pEvent, pOperator );
break;
}
}
示例5: Operator_HandleAnimEvent
//-----------------------------------------------------------------------------
// Purpose:
// Input :
// Output :
//-----------------------------------------------------------------------------
void CWeaponStickyLauncher::Operator_HandleAnimEvent( animevent_t *pEvent, CBaseCombatCharacter *pOperator )
{
switch( pEvent->event )
{
case EVENT_WEAPON_PISTOL_FIRE:
{
Vector vecShootOrigin, vecShootDir;
vecShootOrigin = pOperator->Weapon_ShootPosition();
CAI_BaseNPC *npc = pOperator->MyNPCPointer();
if (npc)
{
vecShootDir = npc->GetActualShootTrajectory( vecShootOrigin );
}
else
{
AngleVectors( pOperator->GetLocalAngles(), &vecShootDir );
}
WeaponSound( SINGLE_NPC );
LaunchStickyBomb( pOperator, vecShootOrigin, vecShootDir );
pOperator->m_fEffects |= EF_MUZZLEFLASH;
m_iClip1 = m_iClip1 - 1;
}
break;
default:
BaseClass::Operator_HandleAnimEvent( pEvent, pOperator );
break;
}
}
示例6: FireNPCPrimaryAttack
//=========================================================
// Disparo primario desde un NPC.
//=========================================================
void CWeaponAlyxGun::FireNPCPrimaryAttack( CBaseCombatCharacter *pOperator, bool bUseWeaponAngles )
{
Vector vecShootOrigin, vecShootDir;
CAI_BaseNPC *pNPC = pOperator->MyNPCPointer();
ASSERT( pNPC != NULL );
if ( bUseWeaponAngles )
{
QAngle angShootDir;
GetAttachment(LookupAttachment("muzzle"), vecShootOrigin, angShootDir);
AngleVectors(angShootDir, &vecShootDir);
}
else
{
vecShootOrigin = pOperator->Weapon_ShootPosition();
vecShootDir = pNPC->GetActualShootTrajectory(vecShootOrigin);
}
WeaponSound(SINGLE_NPC);
if ( hl2_episodic.GetBool() )
pOperator->FireBullets( 1, vecShootOrigin, vecShootDir, VECTOR_CONE_PRECALCULATED, MAX_TRACE_LENGTH, m_iPrimaryAmmoType, 1 );
else
pOperator->FireBullets( 1, vecShootOrigin, vecShootDir, VECTOR_CONE_PRECALCULATED, MAX_TRACE_LENGTH, m_iPrimaryAmmoType, 2 );
pOperator->DoMuzzleFlash();
// Never fire Alyx's last bullet just in case there's an emergency
// and she needs to be able to shoot without reloading.
if( m_iClip1 > 1 )
m_iClip1 = m_iClip1 - 1;
}
示例7: QAngle
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CWeaponSMG1::Operator_HandleAnimEvent( animevent_t *pEvent, CBaseCombatCharacter *pOperator )
{
switch( pEvent->event )
{
case EVENT_WEAPON_SMG1:
{
Vector vecShootOrigin, vecShootDir;
QAngle angDiscard;
// Support old style attachment point firing
if ((pEvent->options == NULL) || (pEvent->options[0] == '\0') || (!pOperator->GetAttachment(pEvent->options, vecShootOrigin, angDiscard)))
{
vecShootOrigin = pOperator->Weapon_ShootPosition();
}
CAI_BaseNPC *npc = pOperator->MyNPCPointer();
ASSERT( npc != NULL );
vecShootDir = npc->GetActualShootTrajectory( vecShootOrigin );
FireNPCPrimaryAttack( pOperator, vecShootOrigin, vecShootDir );
}
break;
/*//FIXME: Re-enable
case EVENT_WEAPON_AR2_GRENADE:
{
CAI_BaseNPC *npc = pOperator->MyNPCPointer();
Vector vecShootOrigin, vecShootDir;
vecShootOrigin = pOperator->Weapon_ShootPosition();
vecShootDir = npc->GetShootEnemyDir( vecShootOrigin );
Vector vecThrow = m_vecTossVelocity;
CGrenadeAR2 *pGrenade = (CGrenadeAR2*)Create( "grenade_ar2", vecShootOrigin, vec3_angle, npc );
pGrenade->SetAbsVelocity( vecThrow );
pGrenade->SetLocalAngularVelocity( QAngle( 0, 400, 0 ) );
pGrenade->SetMoveType( MOVETYPE_FLYGRAVITY );
pGrenade->m_hOwner = npc;
pGrenade->m_pMyWeaponAR2 = this;
pGrenade->SetDamage(sk_npc_dmg_ar2_grenade.GetFloat());
// FIXME: arrgg ,this is hard coded into the weapon???
m_flNextGrenadeCheck = gpGlobals->curtime + 6;// wait six seconds before even looking again to see if a grenade can be thrown.
m_iClip2--;
}
break;
*/
default:
BaseClass::Operator_HandleAnimEvent( pEvent, pOperator );
break;
}
}
示例8: ToBasePlayer
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CWeapon357::Operator_HandleAnimEvent( animevent_t *pEvent, CBaseCombatCharacter *pOperator )
{
switch( pEvent->event )
{
case EVENT_WEAPON_PISTOL_FIRE:
{
Vector vecShootOrigin, vecShootDir;
vecShootOrigin = pOperator->Weapon_ShootPosition();
CAI_BaseNPC *npc = pOperator->MyNPCPointer();
ASSERT(npc != NULL);
vecShootDir = npc->GetActualShootTrajectory(vecShootOrigin);
CSoundEnt::InsertSound(SOUND_COMBAT | SOUND_CONTEXT_GUNFIRE, pOperator->GetAbsOrigin(), SOUNDENT_VOLUME_PISTOL, 0.2, pOperator, SOUNDENT_CHANNEL_WEAPON, pOperator->GetEnemy());
WeaponSound(SINGLE_NPC);
pOperator->FireBullets(1, vecShootOrigin, vecShootDir, VECTOR_CONE_PRECALCULATED, MAX_TRACE_LENGTH, m_iPrimaryAmmoType, 2);
pOperator->DoMuzzleFlash();
m_iClip1 = m_iClip1 - 1;
}
case EVENT_WEAPON_RELOAD:
{
CBasePlayer *pOwner = ToBasePlayer(GetOwner());
CEffectData data;
// Emit six spent shells
for (int i = 0; i < 6; i++)
{
data.m_vOrigin = pOwner->WorldSpaceCenter() + RandomVector(-4, 4);
data.m_vAngles = QAngle(90, random->RandomInt(0, 360), 0);
data.m_nEntIndex = entindex();
DispatchEffect("ShellEject", data);
}
}
break;
default:
BaseClass::Operator_HandleAnimEvent(pEvent, pOperator);
break;
}
}
示例9: FireNPCPrimaryAttack
//-----------------------------------------------------------------------------
// Purpose:
// Input : *pOperator -
//-----------------------------------------------------------------------------
void CWeaponShotgun::FireNPCPrimaryAttack( CBaseCombatCharacter *pOperator, bool bUseWeaponAngles )
{
Vector vecShootOrigin, vecShootDir;
CAI_BaseNPC *npc = pOperator->MyNPCPointer();
ASSERT( npc != NULL );
WeaponSound( SINGLE_NPC );
pOperator->DoMuzzleFlash();
m_iClip1 = m_iClip1 - 1;
if ( bUseWeaponAngles )
{
QAngle angShootDir;
GetAttachment( LookupAttachment( "muzzle" ), vecShootOrigin, angShootDir );
AngleVectors( angShootDir, &vecShootDir );
}
else
{
vecShootOrigin = pOperator->Weapon_ShootPosition();
vecShootDir = npc->GetActualShootTrajectory( vecShootOrigin );
}
pOperator->FireBullets( 8, vecShootOrigin, vecShootDir, GetBulletSpread(), MAX_TRACE_LENGTH, m_iPrimaryAmmoType, 0 );
}
示例10: Operator_HandleAnimEvent
void CWeaponOICW::Operator_HandleAnimEvent(animevent_t *pEvent, CBaseCombatCharacter *pOperator)
{
switch (pEvent->event)
{
case EVENT_WEAPON_AR2:
{
Vector vecShootOrigin, vecShootDir;
vecShootOrigin = pOperator->Weapon_ShootPosition();
CAI_BaseNPC *npc = pOperator->MyNPCPointer();
ASSERT(npc != NULL);
vecShootDir = npc->GetActualShootTrajectory(vecShootOrigin);
WeaponSound(SINGLE_NPC);
pOperator->FireBullets(1, vecShootOrigin, vecShootDir, VECTOR_CONE_PRECALCULATED, MAX_TRACE_LENGTH, m_iPrimaryAmmoType, 2);
pOperator->DoMuzzleFlash();
m_iClip1 = m_iClip1 - 1;
}
break;
default:
CBaseCombatWeapon::Operator_HandleAnimEvent(pEvent, pOperator);
break;
}
}
示例11: FireNPCPrimaryAttack
void CWeaponShotgun::FireNPCPrimaryAttack( CBaseCombatCharacter *pOperator, bool bUseWeaponAngles )
{
Vector vecShootOrigin, vecShootDir;
CAI_BaseNPC *npc = pOperator->MyNPCPointer();
ASSERT( npc != NULL );
WeaponSound( SINGLE_NPC );
pOperator->DoMuzzleFlash();
m_iClip1 -= 1;
if ( bUseWeaponAngles )
{
QAngle angShootDir;
GetAttachment( LookupAttachment( "muzzle" ), vecShootOrigin, angShootDir );
AngleVectors( angShootDir, &vecShootDir );
}
else
{
vecShootOrigin = pOperator->Weapon_ShootPosition();
vecShootDir = npc->GetActualShootTrajectory( vecShootOrigin );
}
PrepareFireBullets(5, pOperator, vecShootOrigin, vecShootDir, false);
}
示例12: Operator_HandleAnimEvent
void Operator_HandleAnimEvent( animevent_t *pEvent, CBaseCombatCharacter *pOperator )
{
switch( pEvent->event )
{
case EVENT_WEAPON_SMG1:
{
Vector vecShootOrigin, vecShootDir;
QAngle angDiscard;
if ((pEvent->options == NULL) || (pEvent->options[0] == '\0') || (!pOperator->GetAttachment(pEvent->options, vecShootOrigin, angDiscard)))
{
vecShootOrigin = pOperator->Weapon_ShootPosition();
}
CAI_BaseNPC *npc = pOperator->MyNPCPointer();
ASSERT( npc != NULL );
vecShootDir = npc->GetActualShootTrajectory( vecShootOrigin );
// all of these fire a bullet, but they make different sounds
if ( pEvent->event == EVENT_WEAPON_SMG1 )
{
WeaponSound(SINGLE_NPC);
}
pOperator->FireBullets( 1, vecShootOrigin, vecShootDir, VECTOR_CONE_PRECALCULATED, MAX_TRACE_LENGTH, m_iPrimaryAmmoType, 2, entindex(), 0 );
pOperator->m_fEffects |= EF_MUZZLEFLASH;
m_iClip1 = m_iClip1 - 1;
}
break;
/*//FIXME: Re-enable
case EVENT_WEAPON_AR2_GRENADE:
{
CAI_BaseNPC *npc = pOperator->MyNPCPointer();
Vector vecShootOrigin, vecShootDir;
vecShootOrigin = pOperator->Weapon_ShootPosition();
vecShootDir = npc->GetShootEnemyDir( vecShootOrigin );
Vector vecThrow = m_vecTossVelocity;
CGrenadeAR2 *pGrenade = (CGrenadeAR2*)Create( "grenade_ar2", vecShootOrigin, vec3_angle, npc );
pGrenade->SetAbsVelocity( vecThrow );
pGrenade->SetLocalAngularVelocity( QAngle( 0, 400, 0 ) );
pGrenade->SetMoveType( MOVETYPE_FLYGRAVITY );
pGrenade->m_hOwner = npc;
pGrenade->m_pMyWeaponAR2 = this;
pGrenade->SetDamage(sk_npc_dmg_ar2_grenade.GetFloat());
// FIXME: arrgg ,this is hard coded into the weapon???
m_flNextGrenadeCheck = gpGlobals->curtime + 6;// wait six seconds before even looking again to see if a grenade can be thrown.
m_iClip2--;
}
break;
*/
default:
BaseClass::Operator_HandleAnimEvent( pEvent, pOperator );
break;
}
}
示例13: if
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CWeaponSMG1::Operator_HandleAnimEvent( animevent_t *pEvent, CBaseCombatCharacter *pOperator )
{
switch( pEvent->event )
{
case EVENT_WEAPON_SMG1:
{
Vector vecShootOrigin, vecShootDir;
QAngle angDiscard;
// Support old style attachment point firing
if ((pEvent->options == NULL) || (pEvent->options[0] == '\0') || (!pOperator->GetAttachment(pEvent->options, vecShootOrigin, angDiscard)))
{
vecShootOrigin = pOperator->Weapon_ShootPosition();
}
CAI_BaseNPC *npc = pOperator->MyNPCPointer();
ASSERT( npc != NULL );
vecShootDir = npc->GetActualShootTrajectory( vecShootOrigin );
FireNPCPrimaryAttack( pOperator, vecShootOrigin, vecShootDir );
}
break;
case EVENT_WEAPON_AR2_ALTFIRE:
{
CAI_BaseNPC *npc = pOperator->MyNPCPointer();
Vector vecShootOrigin, vecShootDir;
vecShootOrigin = pOperator->Weapon_ShootPosition();
//vecShootDir = npc->GetShootEnemyDir( vecShootOrigin );
//Checks if it can fire the grenade
WeaponRangeAttack2Condition();
Vector vecThrow = m_vecTossVelocity;
//If on the rare case the vector is 0 0 0, cancel for avoid launching the grenade without speed
//This should be on WeaponRangeAttack2Condition(), but for some unknown reason return CASE_NONE
//doesn't stop the launch
if (vecThrow == Vector(0, 0, 0))
{
break;
}
CGrenadeAR2 *pGrenade = (CGrenadeAR2*)Create("grenade_ar2", vecShootOrigin, vec3_angle, npc);
pGrenade->SetAbsVelocity(vecThrow);
pGrenade->SetLocalAngularVelocity(RandomAngle(-400, 400)); //tumble in air
pGrenade->SetMoveType(MOVETYPE_FLYGRAVITY, MOVECOLLIDE_FLY_BOUNCE);
pGrenade->SetThrower(GetOwner());
pGrenade->SetGravity(0.5); // lower gravity since grenade is aerodynamic and engine doesn't know it.
pGrenade->SetDamage(sk_plr_dmg_smg1_grenade.GetFloat());
if (g_pGameRules->IsSkillLevel(SKILL_HARD))
{
m_flNextGrenadeCheck = gpGlobals->curtime + RandomFloat(2,3);
}
else if (g_pGameRules->IsSkillLevel(SKILL_VERYHARD))
{
m_flNextGrenadeCheck = gpGlobals->curtime + RandomFloat(1.5,2);
}
else if (g_pGameRules->IsSkillLevel(SKILL_NIGHTMARE))
{
m_flNextGrenadeCheck = gpGlobals->curtime + RandomFloat(1,1.5);
}
else
{
m_flNextGrenadeCheck = gpGlobals->curtime + 6;// wait six seconds before even looking again to see if a grenade can be thrown.
}
m_iClip2--;
}
break;
default:
BaseClass::Operator_HandleAnimEvent( pEvent, pOperator );
break;
}
}