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


C++ C_TFPlayer::IsWeaponLowered方法代码示例

本文整理汇总了C++中C_TFPlayer::IsWeaponLowered方法的典型用法代码示例。如果您正苦于以下问题:C++ C_TFPlayer::IsWeaponLowered方法的具体用法?C++ C_TFPlayer::IsWeaponLowered怎么用?C++ C_TFPlayer::IsWeaponLowered使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在C_TFPlayer的用法示例。


在下文中一共展示了C_TFPlayer::IsWeaponLowered方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: DrawModel

//-----------------------------------------------------------------------------
// Purpose: Don't render the weapon if its supposed to be lowered and we have
// finished the lowering animation
//-----------------------------------------------------------------------------
int CTFViewModel::DrawModel( int flags )
{
    // Check for lowering the weapon
    C_TFPlayer *pPlayer = C_TFPlayer::GetLocalTFPlayer();

    Assert( pPlayer );

    bool bLowered = pPlayer->IsWeaponLowered();

    if ( bLowered && fabs( m_vLoweredWeaponOffset.x - cl_gunlowerangle.GetFloat() ) < 0.1 )
    {
        // fully lowered, stop drawing
        return 1;
    }

    C_TFPlayer *pLocalPlayer = C_TFPlayer::GetLocalTFPlayer();
    if ( pLocalPlayer && pLocalPlayer->GetObserverMode() == OBS_MODE_IN_EYE &&
            pLocalPlayer->GetObserverTarget() && pLocalPlayer->GetObserverTarget()->IsPlayer() )
    {
        pPlayer = ToTFPlayer( pLocalPlayer->GetObserverTarget() );

        if ( pPlayer != GetOwner() )
            return 0;
    }

    if ( pPlayer->IsAlive() == false )
    {
        return 0;
    }

    return BaseClass::DrawModel( flags );
}
开发者ID:MrBoomer568,项目名称:TF2Classic,代码行数:36,代码来源:tf_viewmodel.cpp

示例2: CalcViewModelView

void CTFViewModel::CalcViewModelView( CBasePlayer *owner, const Vector& eyePosition, const QAngle& eyeAngles )
{
#if defined( CLIENT_DLL )

    Vector vecNewOrigin = eyePosition;
    QAngle vecNewAngles = eyeAngles;

    // Check for lowering the weapon
    C_TFPlayer *pPlayer = ToTFPlayer( owner );

    Assert( pPlayer );

    bool bLowered = pPlayer->IsWeaponLowered();

    QAngle vecLoweredAngles(0,0,0);

    m_vLoweredWeaponOffset.x = Approach( bLowered ? cl_gunlowerangle.GetFloat() : 0, m_vLoweredWeaponOffset.x, cl_gunlowerspeed.GetFloat() );
    vecLoweredAngles.x += m_vLoweredWeaponOffset.x;

    vecNewAngles += vecLoweredAngles;


    // Viewmodel offset
    Vector	forward, right, up;
    AngleVectors(eyeAngles, &forward, &right, &up);
    vecNewOrigin += forward*v_viewmodel_offset_x.GetFloat() + right*v_viewmodel_offset_y.GetFloat() + up*v_viewmodel_offset_z.GetFloat();

    if (owner->GetActiveWeapon())
        ToTFPlayer(owner)->GetActiveTFWeapon()->UpdateViewModel();

    BaseClass::CalcViewModelView( owner, vecNewOrigin, vecNewAngles );

#endif
}
开发者ID:MrBoomer568,项目名称:TF2Classic,代码行数:34,代码来源:tf_viewmodel.cpp


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