本文整理汇总了C++中CMomentumPlayer类的典型用法代码示例。如果您正苦于以下问题:C++ CMomentumPlayer类的具体用法?C++ CMomentumPlayer怎么用?C++ CMomentumPlayer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CMomentumPlayer类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetPlayerOwner
void CWeaponG3SG1::G3SG1Fire(float flSpread)
{
CMomentumPlayer *pPlayer = GetPlayerOwner();
if (!pPlayer)
return;
// If we are not zoomed in, or we have very recently zoomed and are still transitioning, the bullet diverts more.
if (pPlayer->GetFOV() == pPlayer->GetDefaultFOV() || (gpGlobals->curtime < m_zoomFullyActiveTime))
flSpread += 0.025;
// Mark the time of this shot and determine the accuracy modifier based on the last shot fired...
m_flAccuracy = 0.55 + (0.3) * (gpGlobals->curtime - m_flLastFire);
if (m_flAccuracy > 0.98)
m_flAccuracy = 0.98;
m_flLastFire = gpGlobals->curtime;
if (!CSBaseGunFire(flSpread, GetCSWpnData().m_flCycleTime, true))
return;
// Adjust the punch angle.
QAngle angle = pPlayer->GetPunchAngle();
angle.x -= SharedRandomFloat("G3SG1PunchAngleX", 0.75, 1.75) + (angle.x / 4);
angle.y += SharedRandomFloat("G3SG1PunchAngleY", -0.75, 0.75);
pPlayer->SetPunchAngle(angle);
}
示例2: GetPlayerOwner
void CWeaponBaseGun::DoFireEffects()
{
CMomentumPlayer *pPlayer = GetPlayerOwner();
if (pPlayer)
pPlayer->DoMuzzleFlash();
}
示例3: ToCMOMPlayer
void CTriggerLimitMovement::Think()
{
CMomentumPlayer *pPlayer = ToCMOMPlayer(UTIL_GetListenServerHost());
if (pPlayer && IsTouching(pPlayer))
{
if (HasSpawnFlags(LIMIT_BHOP))
{
pPlayer->DisableButtons(IN_JUMP);
// if player in air
if (pPlayer->GetGroundEntity() != nullptr)
{
// only start timer if we havent already started
if (!m_BhopTimer.HasStarted())
m_BhopTimer.Start(FL_BHOP_TIMER);
// when finished
if (m_BhopTimer.IsElapsed())
{
pPlayer->EnableButtons(IN_JUMP);
m_BhopTimer.Reset();
}
}
}
}
// figure out if timer elapsed or not
if (m_BhopTimer.GetRemainingTime() <= 0)
m_BhopTimer.Invalidate();
// DevLog("Bhop Timer Remaining Time:%f\n", m_BhopTimer.GetRemainingTime());
// HACKHACK - this prevents think from running too fast, breaking the timer
// and preventing the player from jumping until the timer runs out
// Thinking every 0.25 seconds seems to feel good, but we can adjust this later
SetNextThink(gpGlobals->curtime + 0.25);
BaseClass::Think();
}
示例4: GetPlayerOwner
void CWeaponUMP45::PrimaryAttack()
{
CMomentumPlayer *pPlayer = GetPlayerOwner();
if (!pPlayer)
return;
if (!FBitSet(pPlayer->GetFlags(), FL_ONGROUND))
UMP45Fire(0.24f * m_flAccuracy);
else
UMP45Fire(0.04f * m_flAccuracy);
}
示例5: GetCSWpnData
void CWeaponAug::AUGFire(float flSpread, bool bZoomed)
{
float flCycleTime = GetCSWpnData().m_flCycleTime;
if (bZoomed)
flCycleTime = 0.135f;
if (!CSBaseGunFire(flSpread, flCycleTime, true))
return;
CMomentumPlayer *pPlayer = GetPlayerOwner();
// CSBaseGunFire can kill us, forcing us to drop our weapon, if we shoot something that explodes
if (!pPlayer)
return;
if (pPlayer->GetAbsVelocity().Length2D() > 5)
pPlayer->KickBack(1, 0.45, 0.275, 0.05, 4, 2.5, 7);
else if (!FBitSet(pPlayer->GetFlags(), FL_ONGROUND))
pPlayer->KickBack(1.25, 0.45, 0.22, 0.18, 5.5, 4, 5);
else if (FBitSet(pPlayer->GetFlags(), FL_DUCKING))
pPlayer->KickBack(0.575, 0.325, 0.2, 0.011, 3.25, 2, 8);
else
pPlayer->KickBack(0.625, 0.375, 0.25, 0.0125, 3.5, 2.25, 8);
}
示例6: ClientActive
void ClientActive(edict_t *pEdict, bool bLoadGame)
{
CMomentumPlayer *pPlayer = dynamic_cast< CMomentumPlayer* >(CBaseEntity::Instance(pEdict));
Assert(pPlayer);
if (!pPlayer)
{
return;
}
pPlayer->InitialSpawn();
if (!bLoadGame)
{
pPlayer->Spawn();
}
}
示例7: Detonate
void CHEGrenadeProjectile::Detonate()
{
BaseClass::Detonate();
// tell the bots an HE grenade has exploded
CMomentumPlayer *player = static_cast<CMomentumPlayer*>(GetThrower());
if ( player )
{
IGameEvent * event = gameeventmanager->CreateEvent( "hegrenade_detonate" );
if ( event )
{
event->SetInt( "userid", player->GetUserID() );
event->SetFloat( "x", GetAbsOrigin().x );
event->SetFloat( "y", GetAbsOrigin().y );
event->SetFloat( "z", GetAbsOrigin().z );
gameeventmanager->FireEvent( event );
}
}
}
示例8: GetCurrentMaxGroundSpeed
float CCSPlayerAnimState::GetCurrentMaxGroundSpeed()
{
Activity currentActivity = m_pOuter->GetSequenceActivity( m_pOuter->GetSequence() );
if ( currentActivity == ACT_WALK || currentActivity == ACT_IDLE )
return ANIM_TOPSPEED_WALK;
else if ( currentActivity == ACT_RUN )
{
if ( m_pPlayer )
{
CBaseCombatWeapon *activeWeapon = m_pPlayer->GetActiveWeapon();
if ( activeWeapon )
{
CWeaponCSBase *csWeapon = dynamic_cast< CWeaponCSBase * >( activeWeapon );
if ( csWeapon )
{
return csWeapon->GetMaxSpeed();
}
}
}
return ANIM_TOPSPEED_RUN;
}
else if ( currentActivity == ACT_RUN_CROUCH )
return ANIM_TOPSPEED_RUN_CROUCH;
else
return 0;
}