本文整理汇总了C++中CBaseViewModel::SetPlaybackRate方法的典型用法代码示例。如果您正苦于以下问题:C++ CBaseViewModel::SetPlaybackRate方法的具体用法?C++ CBaseViewModel::SetPlaybackRate怎么用?C++ CBaseViewModel::SetPlaybackRate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBaseViewModel
的用法示例。
在下文中一共展示了CBaseViewModel::SetPlaybackRate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Reload
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 > GetCurrentTime())
return true;
CBaseViewModel *vm = pPlayer->GetViewModel( m_nViewModelIndex );
float flSpeedMultiplier = GetSDKWpnData().m_flReloadTimeMultiplier;
// check to see if we're ready to reload
if (m_iInSpecialReload == 0)
{
pPlayer->SetAnimation( PLAYER_RELOAD );
float flStartTime = 0.5f * flSpeedMultiplier;
pPlayer->DoAnimationEvent( PLAYERANIMEVENT_RELOAD );
SendWeaponAnim( ACT_SHOTGUN_RELOAD_START );
m_iInSpecialReload = 1;
/* this is the only part of the reload sequence that can't be interrupted, seems unnecessary
pPlayer->m_flNextAttack = GetCurrentTime() + flStartTime;
m_flNextPrimaryAttack = GetCurrentTime() + flStartTime;
m_flNextSecondaryAttack = GetCurrentTime() + flStartTime;
*/
SetWeaponIdleTime( GetCurrentTime() + flStartTime );
if (vm)
vm->SetPlaybackRate( 1/flSpeedMultiplier );
pPlayer->Instructor_LessonLearned("reload");
return true;
}
else if (m_iInSpecialReload == 1)
{
if (m_flTimeWeaponIdle > GetCurrentTime())
return true;
// was waiting for gun to move to side
m_iInSpecialReload = 2;
float flReloadTime = 0.45 * flSpeedMultiplier;
SendWeaponAnim( ACT_VM_RELOAD );
SetWeaponIdleTime( GetCurrentTime() + flReloadTime );
pPlayer->DoAnimationEvent( PLAYERANIMEVENT_RELOAD_LOOP );
if (vm)
vm->SetPlaybackRate( 1/flSpeedMultiplier );
}
else if ( m_iInSpecialReload == 2 ) // Sanity, make sure it's actually in the right state.
{
// Add them to the clip
m_iClip1 += 1;
#ifdef GAME_DLL
// Send a message to any clients that have this entity to play the reload.
CPASFilter filter( pPlayer->GetAbsOrigin() );
filter.RemoveRecipient( pPlayer );
UserMessageBegin( filter, "ReloadEffect" );
WRITE_SHORT( pPlayer->entindex() );
MessageEnd();
#endif
if ( pPlayer )
{
bool bConsume = true;
if (pPlayer->IsStyleSkillActive(SKILL_MARKSMAN))
bConsume = false;
if (bConsume)
pPlayer->RemoveAmmo( 1, m_iPrimaryAmmoType );
}
if ( pPlayer->GetAmmoCount( m_iPrimaryAmmoType ) <= 0 || m_iClip1 == GetMaxClip1() )
pPlayer->DoAnimationEvent( PLAYERANIMEVENT_RELOAD_END );
m_iInSpecialReload = 1;
}
return true;
}