本文整理汇总了C++中CTFPlayer::SetAnimation方法的典型用法代码示例。如果您正苦于以下问题:C++ CTFPlayer::SetAnimation方法的具体用法?C++ CTFPlayer::SetAnimation怎么用?C++ CTFPlayer::SetAnimation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTFPlayer
的用法示例。
在下文中一共展示了CTFPlayer::SetAnimation方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LaunchProjectile
//-----------------------------------------------------------------------------
// 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);
}
}
示例2: FireArrow
// ---------------------------------------------------------------------------- -
// 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;
}
示例3: LaunchGrenade
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CTFPipebombLauncher::LaunchGrenade( void )
{
// Get the player owning the weapon.
CTFPlayer *pPlayer = ToTFPlayer( GetPlayerOwner() );
if ( !pPlayer )
return;
StopSound("Weapon_StickyBombLauncher.ChargeUp");
CalcIsAttackCritical();
SendWeaponAnim( ACT_VM_PRIMARYATTACK );
pPlayer->SetAnimation( PLAYER_ATTACK1 );
pPlayer->DoAnimationEvent( PLAYERANIMEVENT_ATTACK_PRIMARY );
CTFGrenadePipebombProjectile *pProjectile = static_cast<CTFGrenadePipebombProjectile*>( FireProjectile( pPlayer ) );
if ( pProjectile )
{
// Save the charge time to scale the detonation timer.
pProjectile->SetChargeTime( gpGlobals->curtime - m_flChargeBeginTime );
}
#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;
m_flLastDenySoundTime = gpGlobals->curtime;
SetWeaponIdleTime( gpGlobals->curtime + SequenceDuration() );
// Check the reload mode and behave appropriately.
if ( m_bReloadsSingly )
{
m_iReloadMode.Set( TF_RELOAD_START );
}
m_flChargeBeginTime = 0;
}
示例4: LaunchGrenade
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CTFPipebombLauncher::LaunchGrenade( 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.
float flDelay = m_pWeaponInfo->GetWeaponData( m_iWeaponMode ).m_flTimeFireDelay;
CALL_ATTRIB_HOOK_FLOAT( flDelay, mult_postfiredelay );
m_flNextPrimaryAttack = gpGlobals->curtime + flDelay;
m_flLastDenySoundTime = gpGlobals->curtime;
SetWeaponIdleTime( gpGlobals->curtime + SequenceDuration() );
// Check the reload mode and behave appropriately.
if ( m_bReloadsSingly )
{
m_iReloadMode.Set( TF_RELOAD_START );
}
m_flChargeBeginTime = 0;
}
示例5: PrimaryAttack
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CTFWeaponBaseGun::PrimaryAttack( void )
{
// Check for ammunition.
if ( m_iClip1 <= 0 && m_iClip1 != -1 )
return;
// Are we capable of firing again?
if ( m_flNextPrimaryAttack > gpGlobals->curtime )
return;
// Get the player owning the weapon.
CTFPlayer *pPlayer = ToTFPlayer( GetPlayerOwner() );
if ( !pPlayer )
return;
if ( !CanAttack() )
return;
CalcIsAttackCritical();
#ifndef CLIENT_DLL
pPlayer->RemoveInvisibility();
pPlayer->RemoveDisguise();
// Minigun has custom handling
if ( GetWeaponID() != TF_WEAPON_MINIGUN )
{
pPlayer->SpeakWeaponFire();
}
CTF_GameStats.Event_PlayerFiredWeapon( pPlayer, IsCurrentAttackACrit() );
#endif
// Set the weapon mode.
m_iWeaponMode = TF_WEAPON_PRIMARY_MODE;
SendWeaponAnim( ACT_VM_PRIMARYATTACK );
pPlayer->SetAnimation( PLAYER_ATTACK1 );
FireProjectile( pPlayer );
m_flLastFireTime = gpGlobals->curtime;
// Set next attack times.
m_flNextPrimaryAttack = gpGlobals->curtime + m_pWeaponInfo->GetWeaponData( m_iWeaponMode ).m_flTimeFireDelay;
// Don't push out secondary attack, because our secondary fire
// systems are all separate from primary fire (sniper zooming, demoman pipebomb detonating, etc)
//m_flNextSecondaryAttack = gpGlobals->curtime + m_pWeaponInfo->GetWeaponData( m_iWeaponMode ).m_flTimeFireDelay;
// Set the idle animation times based on the sequence duration, so that we play full fire animations
// that last longer than the refire rate may allow.
if ( Clip1() > 0 )
{
SetWeaponIdleTime( gpGlobals->curtime + SequenceDuration() );
}
else
{
SetWeaponIdleTime( gpGlobals->curtime + SequenceDuration() );
}
// Check the reload mode and behave appropriately.
if ( m_bReloadsSingly )
{
m_iReloadMode.Set( TF_RELOAD_START );
}
}
示例6: PrimaryAttack
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CTFWeaponBaseGun::PrimaryAttack( void )
{
// Check for ammunition.
if ( m_iClip1 <= 0 && UsesClipsForAmmo1() )
return;
// Get the player owning the weapon.
CTFPlayer *pPlayer = ToTFPlayer( GetPlayerOwner() );
if ( !pPlayer )
return;
if ( !CanAttack() )
return;
if ( m_pWeaponInfo->GetWeaponData( TF_WEAPON_PRIMARY_MODE ).m_nBurstSize > 0 && m_iBurstSize == 0 )
{
// Start the burst.
m_iBurstSize = m_pWeaponInfo->GetWeaponData( TF_WEAPON_PRIMARY_MODE ).m_nBurstSize;
}
if ( m_iBurstSize > 0 )
{
m_iBurstSize--;
}
CalcIsAttackCritical();
#ifndef CLIENT_DLL
pPlayer->RemoveInvisibility();
pPlayer->RemoveDisguise();
// Minigun has custom handling
if ( GetWeaponID() != TF_WEAPON_MINIGUN )
{
pPlayer->SpeakWeaponFire();
}
CTF_GameStats.Event_PlayerFiredWeapon( pPlayer, IsCurrentAttackACrit() );
#endif
// Set the weapon mode.
m_iWeaponMode = TF_WEAPON_PRIMARY_MODE;
SendWeaponAnim( ACT_VM_PRIMARYATTACK );
pPlayer->SetAnimation( PLAYER_ATTACK1 );
FireProjectile( pPlayer );
m_flLastFireTime = gpGlobals->curtime;
// Set next attack times.
float flFireDelay = m_pWeaponInfo->GetWeaponData( m_iWeaponMode ).m_flTimeFireDelay;
CALL_ATTRIB_HOOK_FLOAT( flFireDelay, mult_postfiredelay );
m_flNextPrimaryAttack = gpGlobals->curtime + flFireDelay;
// Don't push out secondary attack, because our secondary fire
// systems are all separate from primary fire (sniper zooming, demoman pipebomb detonating, etc)
//m_flNextSecondaryAttack = gpGlobals->curtime + m_pWeaponInfo->GetWeaponData( m_iWeaponMode ).m_flTimeFireDelay;
// Set the idle animation times based on the sequence duration, so that we play full fire animations
// that last longer than the refire rate may allow.
SetWeaponIdleTime( gpGlobals->curtime + SequenceDuration() );
AbortReload();
}