当前位置: 首页>>代码示例>>C++>>正文


C++ CMomentumPlayer类代码示例

本文整理汇总了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);
}
开发者ID:Asunaya,项目名称:game,代码行数:27,代码来源:weapon_cs_rifles.cpp

示例2: GetPlayerOwner

void CWeaponBaseGun::DoFireEffects()
{
    CMomentumPlayer *pPlayer = GetPlayerOwner();

    if (pPlayer)
        pPlayer->DoMuzzleFlash();
}
开发者ID:bonjorno7,项目名称:GAME,代码行数:7,代码来源:weapon_base_gun.cpp

示例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();
}
开发者ID:xDShot,项目名称:game,代码行数:35,代码来源:mom_triggers.cpp

示例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);
}
开发者ID:Asunaya,项目名称:game,代码行数:11,代码来源:weapon_cs_smgs.cpp

示例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);
}
开发者ID:Asunaya,项目名称:game,代码行数:28,代码来源:weapon_cs_rifles.cpp

示例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();
    }
}
开发者ID:Ravennholm,项目名称:game,代码行数:17,代码来源:mom_client.cpp

示例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 );
        }
    }
}
开发者ID:Asunaya,项目名称:game,代码行数:19,代码来源:hegrenade_projectile.cpp

示例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;
}
开发者ID:Asunaya,项目名称:game,代码行数:26,代码来源:cs_playeranimstate.cpp


注:本文中的CMomentumPlayer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。