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


C++ C_BaseAnimating::SetModelScale方法代码示例

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


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

示例1: ClientThink

//-----------------------------------------------------------------------------
// Purpose: 
// Input  : timeDelta - 
//-----------------------------------------------------------------------------
void C_ASW_AOEGrenade_Projectile::ClientThink( void )
{
    float	baseScale = m_flScale;
    float	flTimeLeft = m_flTimeBurnOut - gpGlobals->curtime;
    //Account for fading out
    if ( ( m_flTimeBurnOut != -1.0f ) && ( flTimeLeft <= 5.0f ) )
    {
        baseScale *= ( flTimeLeft / 5.0f );

        CSoundEnvelopeController::GetController().SoundChangeVolume( m_pLoopedSound, clamp<float>(0.6f * baseScale, 0.0f, 0.6f), 0 );

        AOEGrenTargetFXList_t::IndexLocalType_t i = m_hAOETargetEffects.Head();
        while ( m_hAOETargetEffects.IsValidIndex(i) )
        {
            // Are we still buffing this target?
            for ( int target = 0; target < m_hAOETargets.Count(); target++ )
            {
                if ( m_hAOETargetEffects[i].pBuffLoopSound )
                {
                    CSoundEnvelopeController::GetController().SoundChangeVolume( m_hAOETargetEffects[i].pBuffLoopSound, clamp<float>(0.6f * baseScale, 0.0f, 0.6f), 0 );
                }
            }

            i = m_hAOETargetEffects.Next( i );
        }
    }

    if ( baseScale < 0.01f )
        return;
    //
    // Dynamic light
    //

    if ( m_fStartLightTime == 0.0f )
    {
        m_fStartLightTime = gpGlobals->curtime;
    }
    if ( !m_pDLight )
    {
        m_pDLight = effects->CL_AllocDlight( index );

        Color rgbaGrenadeColor = GetGrenadeColor();

        m_pDLight->color.r = rgbaGrenadeColor.r();
        m_pDLight->color.g = rgbaGrenadeColor.g();
        m_pDLight->color.b = rgbaGrenadeColor.b();
        m_pDLight->color.exponent = 1;
    }

    
    m_pDLight->origin = GetAbsOrigin() + Vector(0, 0, 5);	// make the dlight slightly higher than the aoegrenade, so it doesn't bury the light being so close to the ground

    if ( m_fLightRadius < 32.0f )
    {
        m_fLightRadius += flTimeLeft * (1.0f + random->RandomFloat() * 36.0f);
        if (m_fLightRadius > 32.0f)
            m_fLightRadius = 100.0f;
    }

    m_pDLight->radius = baseScale * 120 * (m_fLightRadius/32.0f);

    if ( flTimeLeft > 4.0f )
    {
        m_pDLight->die = gpGlobals->curtime + 30.0f;
    }


    // spehere bubble models
    if ( !ShouldSpawnSphere() || !m_hSphereModel.Get() )
        return;

    C_BaseAnimating *pSphere = static_cast<C_BaseAnimating*>( m_hSphereModel.Get() );
    if ( pSphere )
    {
        float	flTimeLeft = m_flTimeBurnOut - gpGlobals->curtime;

        float flScale = GetSphereScale();

        if ( m_flTimeCreated > 0 && ( gpGlobals->curtime - m_flTimeCreated ) < 0.25f )
        {
            pSphere->SetModelScale( MIN( ((gpGlobals->curtime - m_flTimeCreated)/0.25f)*flScale, 1.0f ) );
        }
        else
        {
            pSphere->SetModelScale( flScale );
        }

        if ( flTimeLeft < 0.25f )
        {
            pSphere->SetModelScale( MAX( (flTimeLeft/0.25f)*flScale, 0.01f ) );
        }
    }

    if ( m_fUpdateAttachFXTime < gpGlobals->curtime )
    {
        AOEGrenTargetFXList_t::IndexLocalType_t i = m_hAOETargetEffects.Head();
//.........这里部分代码省略.........
开发者ID:Au-heppa,项目名称:swarm-sdk,代码行数:101,代码来源:c_asw_aoegrenade_projectile.cpp


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