本文整理汇总了C++中PrimaryAttack函数的典型用法代码示例。如果您正苦于以下问题:C++ PrimaryAttack函数的具体用法?C++ PrimaryAttack怎么用?C++ PrimaryAttack使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PrimaryAttack函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ToBasePlayer
//-----------------------------------------------------------------------------
// Purpose: Override so SLAM to so secondary attack when no secondary ammo
// but satchel is in the world
// Input :
// Output :
//-----------------------------------------------------------------------------
void CWeapon_SLAM::ItemPostFrame( void )
{
CBasePlayer *pOwner = ToBasePlayer( GetOwner() );
if (!pOwner)
{
return;
}
if ((pOwner->m_nButtons & IN_ATTACK2) && (m_flNextSecondaryAttack <= gpGlobals->curtime))
{
SecondaryAttack();
}
else if (!m_bNeedReload && (pOwner->m_nButtons & IN_ATTACK) && (m_flNextPrimaryAttack <= gpGlobals->curtime))
{
PrimaryAttack();
}
// -----------------------
// No buttons down
// -----------------------
else
{
WeaponIdle( );
return;
}
}
示例2: PrimaryAttack
//Fire both barrels
void CWeaponSawedOff::SecondaryAttack( void )
{
if ( m_iClip1 < 2 )
{
if ( m_iClip1 == 1 )
PrimaryAttack();
return;
}
CBasePlayer *pOwner = ToBasePlayer( GetOwner() );
WeaponSound(WPN_DOUBLE);
pOwner->DoMuzzleFlash();
SendWeaponAnim( ACT_VM_SECONDARYATTACK );
m_iClip1 -= 2;
pOwner->SetAnimation( PLAYER_ATTACK1 );
Vector vecSrc = pOwner->Weapon_ShootPosition( );
Vector vecAiming = pOwner->GetAutoaimVector( AUTOAIM_SCALE_DEFAULT );
FireBulletsInfo_t info( 14, vecSrc, vecAiming, CDHLBaseWeapon::GetBulletSpread(), MAX_TRACE_LENGTH, m_iPrimaryAmmoType );
info.m_pAttacker = pOwner;
pOwner->FireBullets( info );
AddDHLViewKick( BaseClass::GetRecoilX(), BaseClass::GetRecoilY() );
}
示例3: ToBasePlayer
void CWeaponGravityGun::ItemPostFrame( void )
{
CBasePlayer *pOwner = ToBasePlayer( GetOwner() );
if (!pOwner)
return;
if ( pOwner->m_afButtonPressed & IN_ATTACK2 )
{
SecondaryAttack();
}
else if ( pOwner->m_nButtons & IN_ATTACK )
{
PrimaryAttack();
}
else if ( pOwner->m_afButtonPressed & IN_RELOAD )
{
Reload();
}
// -----------------------
// No buttons down
// -----------------------
else
{
WeaponIdle( );
return;
}
}
示例4: ToBasePlayer
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CWeaponCombatBaseGrenade::ItemPostFrame( void )
{
CBasePlayer *pOwner = ToBasePlayer( GetOwner() );
if (!pOwner)
return;
AllowShieldPostFrame( !m_flStartedThrowAt );
// Look for button downs
if ( (pOwner->m_nButtons & IN_ATTACK) && GetShieldState() == SS_DOWN && !m_flStartedThrowAt && (m_flNextPrimaryAttack <= gpGlobals->curtime) )
{
m_flStartedThrowAt = gpGlobals->curtime;
SendWeaponAnim( ACT_VM_DRAW );
}
// Look for button ups
if ( (pOwner->m_afButtonReleased & IN_ATTACK) && (m_flNextPrimaryAttack <= gpGlobals->curtime) && m_flStartedThrowAt )
{
m_flNextPrimaryAttack = gpGlobals->curtime;
PrimaryAttack();
m_flStartedThrowAt = 0;
}
// No buttons down?
if ( !((pOwner->m_nButtons & IN_ATTACK) || (pOwner->m_nButtons & IN_ATTACK2) || (pOwner->m_nButtons & IN_RELOAD)) )
{
WeaponIdle( );
}
}
示例5: ToGEPlayer
void CWeaponAR33::ItemPostFrame( void )
{
CGEPlayer *pOwner = ToGEPlayer ( GetOwner() );
if ( !pOwner )
return;
if ( !m_bInBurst && m_nNumShotsFired > 0 )
m_iBurst = (m_nNumShotsFired < 3) ? (3 - m_nNumShotsFired) : (m_nNumShotsFired % 3);
if ( m_iBurst > 0 && ( pOwner->m_nButtons & IN_ATTACK ) == false && !pOwner->IsInAimMode() )
{
m_bInBurst = true;
if ( gpGlobals->curtime > m_flNextPrimaryAttack )
{
PrimaryAttack();
m_iBurst--;
}
}
else
{
m_bInBurst = false;
m_iBurst = 0;
}
BaseClass::ItemPostFrame();
}
示例6: ToBasePlayer
//-----------------------------------------------------------------------------
// Purpose: Override so shotgun can do mulitple reloads in a row
// Input :
// Output :
//-----------------------------------------------------------------------------
void CWeaponMolotov::ItemPostFrame( void )
{
CBasePlayer *pOwner = ToBasePlayer( GetOwner() );
if (!pOwner)
{
return;
}
if ((pOwner->m_nButtons & IN_ATTACK2) && (m_flNextSecondaryAttack <= gpGlobals->curtime))
{
SecondaryAttack();
}
else if ((pOwner->m_nButtons & IN_ATTACK) && (m_flNextPrimaryAttack <= gpGlobals->curtime))
{
// Uses secondary ammo only
if (pOwner->GetAmmoCount(m_iSecondaryAmmoType))
{
PrimaryAttack();
}
}
else if (m_bNeedDraw)
{
DrawAmmo();
}
else
{
WeaponIdle( );
}
}
示例7: GetPlayerOwner
//=====================================================================================//
// Purpose: Controls the attacks and the call of WeaponIdle() method
//=====================================================================================//
void CTDPBludgeonWeaponBase::ItemPostFrame()
{
// Do we have a valid owner holding the weapon?
CTDPPlayer *pPlayer = GetPlayerOwner();
if ( !pPlayer )
return;
static int lastButton = 0;
//TDP_TODO
if ( pPlayer->m_nButtons & IN_ATTACK3 && m_flNextSecondaryAttack <= gpGlobals->curtime && (lastButton != pPlayer->m_afButtonPressed) )
{
ThirdAttack();
}
lastButton = pPlayer->m_afButtonPressed;
// Is the player pressing the secondary attack button and is it time for the next
// secondary attack?
if ( pPlayer->m_nButtons & IN_ATTACK2 && m_flNextSecondaryAttack <= gpGlobals->curtime )
SecondaryAttack();
// Is the player pressing the primary attack button and is it time for the next
// primary attack?
if ( pPlayer->m_nButtons & IN_ATTACK && m_flNextPrimaryAttack <= gpGlobals->curtime )
PrimaryAttack();
// If the player is not pressing any of the attack buttons let's try to idle
if ( !( pPlayer->m_nButtons & IN_ATTACK3 || pPlayer->m_nButtons & IN_ATTACK2 || pPlayer->m_nButtons & IN_ATTACK ) )
WeaponIdle();
//BaseClass::ItemPostFrame(); // Make this conditionnal
return;
}
示例8: ToBasePlayer
//------------------------------------------------------------------------------
// Purpose : Update weapon
//------------------------------------------------------------------------------
void CBaseHLBludgeonWeapon::ItemPostFrame( void )
{
CBasePlayer *pOwner = ToBasePlayer( GetOwner() );
if ( pOwner == NULL )
return;
if ( CheckSwingMotion() )
{
// Handles it's own animation....
}
else if ( (pOwner->m_nButtons & IN_ATTACK) && (m_flNextPrimaryAttack <= gpGlobals->curtime) )
{
PrimaryAttack();
}
else if ( (pOwner->m_nButtons & IN_ATTACK2) && (m_flNextSecondaryAttack <= gpGlobals->curtime) )
{
SecondaryAttack();
}
else
{
WeaponIdle();
return;
}
}
示例9: PrimaryAttack
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CWeaponMortar::Fire( float flPower, float flAccuracy )
{
m_flFiringPower = flPower;
m_flFiringAccuracy = flAccuracy;
PrimaryAttack();
}
示例10: ToBaseTFPlayer
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CWeaponBuilder::ItemPostFrame( void )
{
CBaseTFPlayer *pOwner = ToBaseTFPlayer( GetOwner() );
if ( !pOwner )
return;
// Ignore input while the player's building anything
if ( pOwner->IsBuilding() )
return;
// Switch away if I'm not in placement mode
if ( m_iBuildState != BS_PLACING && m_iBuildState != BS_PLACING_INVALID )
{
pOwner->SwitchToNextBestWeapon( NULL );
return;
}
if (( pOwner->m_nButtons & IN_ATTACK ) && (m_flNextPrimaryAttack <= gpGlobals->curtime) )
{
PrimaryAttack();
}
// Allow shield post frame
AllowShieldPostFrame( true );
WeaponIdle();
}
示例11: PrimaryAttack
bool CASW_Weapon_Buff_Grenade::OffhandActivate()
{
if (!GetMarine() || GetMarine()->GetFlags() & FL_FROZEN) // don't allow this if the marine is frozen
return false;
PrimaryAttack();
return true;
}
示例12: PrimaryAttack
//-----------------------------------------------------------------------------
// Purpose: Allow activation even if this is our last piece of ammo
//-----------------------------------------------------------------------------
void CWeaponHopwire::HandleFireOnEmpty( void )
{
if ( m_hActiveHopWire!= NULL )
{
// FIXME: This toggle is hokey
m_bRedraw = false;
PrimaryAttack();
m_bRedraw = true;
}
}
示例13: PrimaryAttack
bool CASW_Weapon_Stim::OffhandActivate()
{
if (!GetMarine() || GetMarine()->GetFlags() & FL_FROZEN) // don't allow this if the marine is frozen
return false;
if (m_flNextPrimaryAttack < gpGlobals->curtime)
PrimaryAttack();
return true;
}
示例14: ToBasePlayer
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CWeaponGrapple::ItemPostFrame( void )
{
//Enforces being able to use PrimaryAttack and Secondary Attack
CBasePlayer *pOwner = ToBasePlayer( GetOwner() );
if ( ( pOwner->m_nButtons & IN_ATTACK ) )
{
if ( m_flNextPrimaryAttack < gpGlobals->curtime )
{
PrimaryAttack();
}
}
else if ( m_bMustReload ) //&& HasWeaponIdleTimeElapsed() )
{
Reload();
}
if ( ( pOwner->m_afButtonPressed & IN_ATTACK2 ) )
{
if ( m_flNextPrimaryAttack < gpGlobals->curtime )
{
SecondaryAttack();
}
}
else if ( m_bMustReload ) //&& HasWeaponIdleTimeElapsed() )
{
Reload();
}
//Allow a refire as fast as the player can click
if ( ( ( pOwner->m_nButtons & IN_ATTACK ) == false ) )
{
m_flNextPrimaryAttack = gpGlobals->curtime - 0.1f;
}
#ifndef CLIENT_DLL
if ( m_hHook )
{
if ( !(pOwner->m_nButtons & IN_ATTACK) && !(pOwner->m_nButtons & IN_ATTACK2))
{
m_hHook->SetTouch( NULL );
m_hHook->SetThink( NULL );
UTIL_Remove( m_hHook );
m_hHook = NULL;
NotifyHookDied();
m_bMustReload = true;
}
}
#endif
// BaseClass::ItemPostFrame();
}
示例15: ToBaseTFPlayer
//-----------------------------------------------------------------------------
// Purpose: Handle deploying, undeploying, firing, etc.
// TODO: Add a deploy to the firing! Currently no reloading!
//-----------------------------------------------------------------------------
void CWeaponRocketLauncher::ItemPostFrame( void )
{
// Get the player.
CBaseTFPlayer *pPlayer = ToBaseTFPlayer( GetOwner() );
if ( !pPlayer )
return;
if ( UsesClipsForAmmo1() )
{
CheckReload();
}
#if !defined( CLIENT_DLL )
if ( !HasPrimaryAmmo() && ( m_flNextPrimaryAttack <= gpGlobals->curtime ) )
{
pPlayer->SwitchToNextBestWeapon( NULL );
}
#endif
// Handle Firing
if ( GetShieldState() == SS_DOWN && !m_bInReload )
{
// Attempting to fire.
if ( ( pPlayer->m_nButtons & IN_ATTACK ) && ( m_flNextPrimaryAttack <= gpGlobals->curtime ) )
{
if ( m_iClip1 > 0 )
{
PrimaryAttack();
}
else
{
Reload();
}
}
// Reload button (or fire button when we're out of ammo)
if ( m_flNextPrimaryAttack <= gpGlobals->curtime )
{
if ( pPlayer->m_nButtons & IN_RELOAD )
{
Reload();
}
else if ( !((pPlayer->m_nButtons & IN_ATTACK) || (pPlayer->m_nButtons & IN_ATTACK2) || (pPlayer->m_nButtons & IN_RELOAD)) )
{
if ( !m_iClip1 && HasPrimaryAmmo() )
{
Reload();
}
}
}
}
// Prevent shield post frame if we're not ready to attack, or we're charging
AllowShieldPostFrame( m_flNextPrimaryAttack <= gpGlobals->curtime || m_bInReload );
}