本文整理汇总了C++中SetWeaponIdleTime函数的典型用法代码示例。如果您正苦于以下问题:C++ SetWeaponIdleTime函数的具体用法?C++ SetWeaponIdleTime怎么用?C++ SetWeaponIdleTime使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SetWeaponIdleTime函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetPlayerOwner
bool CWeaponShotgun::Reload()
{
CSDKPlayer *pPlayer = GetPlayerOwner();
if (pPlayer->GetAmmoCount( m_iPrimaryAmmoType ) <= 0 || m_iClip1 == GetMaxClip1())
return true;
// don't reload until recoil is done
if (m_flNextPrimaryAttack > gpGlobals->curtime)
return true;
// check to see if we're ready to reload
if (m_fInSpecialReload == 0)
{
pPlayer->SetAnimation( PLAYER_RELOAD );
SendWeaponAnim( ACT_SHOTGUN_RELOAD_START );
m_fInSpecialReload = 1;
pPlayer->m_flNextAttack = gpGlobals->curtime + 0.5;
m_flNextPrimaryAttack = gpGlobals->curtime + 0.5;
m_flNextSecondaryAttack = gpGlobals->curtime + 0.5;
SetWeaponIdleTime( gpGlobals->curtime + 0.5 );
return true;
}
else if (m_fInSpecialReload == 1)
{
if (m_flTimeWeaponIdle > gpGlobals->curtime)
return true;
// was waiting for gun to move to side
m_fInSpecialReload = 2;
SendWeaponAnim( ACT_VM_RELOAD );
SetWeaponIdleTime( gpGlobals->curtime + 0.45 );
}
else
{
// Add them to the clip
m_iClip1 += 1;
#ifdef GAME_DLL
SendReloadEvents();
#endif
CSDKPlayer *pPlayer = GetPlayerOwner();
if ( pPlayer )
pPlayer->RemoveAmmo( 1, m_iPrimaryAmmoType );
m_fInSpecialReload = 1;
}
return true;
}
示例2: GetOwner
bool CWeaponShotgun::Reload( void )
{
CBaseCombatCharacter *pOwner = GetOwner();
if ( pOwner == NULL )
return false;
if ( pOwner->GetAmmoCount( m_iPrimaryAmmoType ) <= 0 )
return false;
if ( m_iClip1 >= GetMaxClip1() )
return false;
// don't reload until recoil is done
if ( m_flNextPrimaryAttack > gpGlobals->curtime )
return false;
// check to see if we're ready to reload
if ( m_fInSpecialReload == 0 )
{
SendWeaponAnim( ACT_SHOTGUN_RELOAD_START );
m_fInSpecialReload = 1;
pOwner->m_flNextAttack = gpGlobals->curtime + 0.6;
SetWeaponIdleTime( gpGlobals->curtime + 0.6 );
m_flNextPrimaryAttack = gpGlobals->curtime + 1.0;
m_flNextSecondaryAttack = gpGlobals->curtime + 1.0;
return true;
}
else if ( m_fInSpecialReload == 1 )
{
if ( !HasWeaponIdleTimeElapsed() )
return false;
// was waiting for gun to move to side
m_fInSpecialReload = 2;
// Play reload on different channel as otherwise steals channel away from fire sound
WeaponSound( RELOAD );
SendWeaponAnim( ACT_VM_RELOAD );
SetWeaponIdleTime( gpGlobals->curtime + 0.5 );
}
else
{
FillClip();
m_fInSpecialReload = 1;
}
return true;
}
示例3: GetPlayerOwner
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CBaseSDKGrenade::SecondaryAttack()
{
if ( m_bRedraw )
return;
CSDKPlayer *pPlayer = GetPlayerOwner();
if ( pPlayer == NULL )
return;
//See if we're ducking
//if ( pPlayer->GetFlags() & FL_DUCKING )
//{
// //Send the weapon animation
// SendWeaponAnim( ACT_VM_SECONDARYATTACK );
//}
//else
{
//Send the weapon animation
SendWeaponAnim( ACT_VM_HAULBACK );
}
// Don't let weapon idle interfere in the middle of a throw!
SetWeaponIdleTime( gpGlobals->curtime + SequenceDuration() );
//Tony; updated; minimum grenade tossing time is 1 second delay! + sequence
m_flNextPrimaryAttack = gpGlobals->curtime + SequenceDuration() + 1.0;
m_flNextSecondaryAttack = gpGlobals->curtime + SequenceDuration() + 1.0;
}
示例4: StartAttackOffSound
void CASW_Weapon_Chainsaw::EndAttack( void )
{
if ( m_fireState != FIRE_OFF )
{
StartAttackOffSound();
#ifdef CLIENT_DLL
DispatchParticleEffect( "mining_laser_exhaust", PATTACH_POINT_FOLLOW, this, "eject1" );
#endif
}
StopChainsawSound();
SetWeaponIdleTime( gpGlobals->curtime + 2.0 );
m_flNextPrimaryAttack = gpGlobals->curtime + GetWeaponInfo()->m_flFireRate;
m_flNextSecondaryAttack = gpGlobals->curtime + GetWeaponInfo()->m_flFireRate;
SetFiringState(FIRE_OFF);
ClearIsFiring();
DestroyEffect();
}
示例5: GetTFPlayerOwner
// ---------------------------------------------------------------------------- -
// Purpose:
//-----------------------------------------------------------------------------
void CTFCompoundBow::FireArrow( void )
{
// Get the player owning the weapon.
CTFPlayer *pPlayer = GetTFPlayerOwner();
if ( !pPlayer )
return;
CalcIsAttackCritical();
SendWeaponAnim( ACT_VM_PRIMARYATTACK );
pPlayer->SetAnimation( PLAYER_ATTACK1 );
pPlayer->DoAnimationEvent( PLAYERANIMEVENT_ATTACK_PRIMARY );
pPlayer->m_Shared.RemoveCond( TF_COND_AIMING );
pPlayer->TeamFortress_SetSpeed();
FireProjectile( pPlayer );
#if !defined( CLIENT_DLL )
pPlayer->SpeakWeaponFire();
CTF_GameStats.Event_PlayerFiredWeapon( pPlayer, IsCurrentAttackACrit() );
#endif
// Set next attack times.
float flDelay = m_pWeaponInfo->GetWeaponData( m_iWeaponMode ).m_flTimeFireDelay;
CALL_ATTRIB_HOOK_FLOAT( flDelay, mult_postfiredelay );
m_flNextPrimaryAttack = gpGlobals->curtime + flDelay;
SetWeaponIdleTime( gpGlobals->curtime + SequenceDuration() );
m_flChargeBeginTime = 0.0f;
}
示例6: switch
//-----------------------------------------------------------------------------
// Purpose:
//
//
//-----------------------------------------------------------------------------
void CHLSelectFireMachineGun::PrimaryAttack( void )
{
if (m_bFireOnEmpty)
{
return;
}
switch( m_iFireMode )
{
case FIREMODE_FULLAUTO:
BaseClass::PrimaryAttack();
// Msg("%.3f\n", m_flNextPrimaryAttack.Get() );
SetWeaponIdleTime( gpGlobals->curtime + 3.0f );
break;
case FIREMODE_3RNDBURST:
m_iBurstSize = GetBurstSize();
// Call the think function directly so that the first round gets fired immediately.
BurstThink();
SetThink( &CHLSelectFireMachineGun::BurstThink );
m_flNextPrimaryAttack = gpGlobals->curtime + GetBurstCycleRate();
m_flNextSecondaryAttack = gpGlobals->curtime + GetBurstCycleRate();
// Pick up the rest of the burst through the think function.
SetNextThink( gpGlobals->curtime + GetFireRate() );
break;
}
CBasePlayer *pOwner = ToBasePlayer( GetOwner() );
if ( pOwner )
{
m_iPrimaryAttacks++;
gamestats->Event_WeaponFired( pOwner, true, GetClassname() );
}
}
示例7: GetPlayerOwner
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CBaseSDKGrenade::SecondaryAttack()
{
if ( m_bRedraw )
return;
CSDKPlayer *pPlayer = GetPlayerOwner();
if ( pPlayer == NULL )
return;
//See if we're ducking
if ( pPlayer->GetFlags() & FL_DUCKING )
{
//Send the weapon animation
SendWeaponAnim( ACT_VM_SECONDARYATTACK );
}
else
{
//Send the weapon animation
SendWeaponAnim( ACT_VM_HAULBACK );
}
// Don't let weapon idle interfere in the middle of a throw!
SetWeaponIdleTime( gpGlobals->curtime + SequenceDuration() );
m_flNextSecondaryAttack = gpGlobals->curtime + SequenceDuration();
}
示例8: GetPlayerOwner
void CWeaponElite::WeaponIdle()
{
CCSPlayer *pPlayer = GetPlayerOwner();
if ( !pPlayer )
return;
if (m_flTimeWeaponIdle > gpGlobals->curtime)
return;
if ( pPlayer->HasShield() )
{
SetWeaponIdleTime( gpGlobals->curtime + 20 );
//MIKETODO: shields
//if ( FBitSet(m_iWeaponState, WPNSTATE_SHIELD_DRAWN) )
// SendWeaponAnim( GLOCK18_SHIELD_IDLE, UseDecrement() ? 1:0 );
}
else
{
// only idle if the slid isn't back
if (m_iClip1 != 0)
{
if ( m_iClip1 == 1 )
SendWeaponAnim( ACT_VM_IDLE_EMPTY_LEFT );
else
SendWeaponAnim( ACT_VM_IDLE );
}
}
}
示例9: CalcIsAttackCritical
//-----------------------------------------------------------------------------
// Purpose:
// Input : *pPlayer -
//-----------------------------------------------------------------------------
void CTFWeaponBaseMelee::Swing( CTFPlayer *pPlayer )
{
CalcIsAttackCritical();
// Play the melee swing and miss (whoosh) always.
SendPlayerAnimEvent( pPlayer );
DoViewModelAnimation();
// Set next attack times.
m_flNextPrimaryAttack = gpGlobals->curtime + m_pWeaponInfo->GetWeaponData( m_iWeaponMode ).m_flTimeFireDelay;
SetWeaponIdleTime( m_flNextPrimaryAttack + m_pWeaponInfo->GetWeaponData( m_iWeaponMode ).m_flTimeIdleEmpty );
if ( IsCurrentAttackACrit() )
{
WeaponSound( BURST );
}
else
{
WeaponSound( MELEE_MISS );
}
m_flSmackTime = gpGlobals->curtime + m_pWeaponInfo->GetWeaponData( m_iWeaponMode ).m_flSmackDelay;
}
示例10: ToBasePlayer
void CWeaponSnark::WeaponIdle( void )
{
CBasePlayer *pPlayer = ToBasePlayer( GetOwner() );
if ( !pPlayer )
{
return;
}
if ( !HasWeaponIdleTimeElapsed() )
return;
if ( m_bJustThrown )
{
m_bJustThrown = false;
if ( pPlayer->GetAmmoCount( m_iPrimaryAmmoType ) <= 0 )
{
if ( !pPlayer->SwitchToNextBestWeapon( pPlayer->GetActiveWeapon() ) )
Holster();
}
else
{
SendWeaponAnim( ACT_VM_DRAW );
SetWeaponIdleTime( gpGlobals->curtime + random->RandomFloat( 10, 15 ) );
}
}
else
{
BaseClass::WeaponIdle();
}
}
示例11: ToTFPlayer
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CTFFlareGun::LaunchProjectile(void)
{
// Get the player owning the weapon.
CTFPlayer *pPlayer = ToTFPlayer(GetPlayerOwner());
if (!pPlayer)
return;
CalcIsAttackCritical();
SendWeaponAnim(ACT_VM_PRIMARYATTACK);
pPlayer->SetAnimation(PLAYER_ATTACK1);
pPlayer->DoAnimationEvent(PLAYERANIMEVENT_ATTACK_PRIMARY);
FireProjectile(pPlayer);
#if !defined( CLIENT_DLL )
pPlayer->SpeakWeaponFire();
CTF_GameStats.Event_PlayerFiredWeapon(pPlayer, IsCurrentAttackACrit());
#endif
// Set next attack times.
m_flNextPrimaryAttack = gpGlobals->curtime + m_pWeaponInfo->GetWeaponData(m_iWeaponMode).m_flTimeFireDelay;
SetWeaponIdleTime(gpGlobals->curtime + SequenceDuration());
// Check the reload mode and behave appropriately.
if (m_bReloadsSingly)
{
m_iReloadMode.Set(TF_RELOAD_START);
}
}
示例12: FireBolt
void CWeaponFlowerLauncher::PrimaryAttack( void )
{
FireBolt();
m_bMustReload = true;
SetWeaponIdleTime( gpGlobals->curtime + SequenceDuration( ACT_VM_PRIMARYATTACK ) );
}
示例13: PrimaryAttack
void PrimaryAttack()
{
m_flNextPrimaryAttack = gpGlobals->curtime + FLT_MAX;
SetWeaponIdleTime( FLT_MAX );
m_flBeamTime = gpGlobals->curtime + 0.2f;
m_flDamageTime = gpGlobals->curtime + 0.2f;
}
示例14: SetWeaponIdleTime
bool CTFWeaponInvis::Deploy( void )
{
bool b = BaseClass::Deploy();
SetWeaponIdleTime( gpGlobals->curtime + 1.5 );
return b;
}
示例15: FireHook
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CWeaponGrapple::PrimaryAttack(void)
{
// Can't have an active hook out
if (m_hHook != NULL)
return;
FireHook();
SetWeaponIdleTime(gpGlobals->curtime + SequenceDuration(ACT_VM_PRIMARYATTACK));
}