本文整理汇总了C++中CNewParticleEffect::SkipToTime方法的典型用法代码示例。如果您正苦于以下问题:C++ CNewParticleEffect::SkipToTime方法的具体用法?C++ CNewParticleEffect::SkipToTime怎么用?C++ CNewParticleEffect::SkipToTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CNewParticleEffect
的用法示例。
在下文中一共展示了CNewParticleEffect::SkipToTime方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ClientThink
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void C_ParticleSystem::ClientThink( void )
{
if ( m_bActive )
{
const char *pszName = GetParticleSystemNameFromIndex( m_iEffectIndex );
if ( pszName && pszName[0] )
{
CNewParticleEffect *pEffect = ParticleProp()->Create( pszName, PATTACH_ABSORIGIN_FOLLOW );
AssertMsg1( pEffect, "Particle system couldn't make %s", pszName );
if (pEffect)
{
for ( int i = 0 ; i < kMAXCONTROLPOINTS ; ++i )
{
CBaseEntity *pOnEntity = m_hControlPointEnts[i].Get();
if ( pOnEntity )
{
ParticleProp()->AddControlPoint( pEffect, i + 1, pOnEntity, PATTACH_ABSORIGIN_FOLLOW );
}
AssertMsg2( m_iControlPointParents[i] >= 0 && m_iControlPointParents[i] <= kMAXCONTROLPOINTS ,
"Particle system specified bogus control point parent (%d) for point %d.",
m_iControlPointParents[i], i );
if (m_iControlPointParents[i] != 0)
{
pEffect->SetControlPointParent(i+1, m_iControlPointParents[i]);
}
}
// NOTE: What we really want here is to compare our lifetime and that of our children and see if this delta is
// already past the end of it, denoting that we're finished. In that case, just destroy us and be done. -- jdw
// TODO: This can go when the SkipToTime code below goes
ParticleProp()->OnParticleSystemUpdated( pEffect, 0.0f );
// Skip the effect ahead if we're restarting it
float flTimeDelta = gpGlobals->curtime - m_flStartTime;
if ( flTimeDelta > 0.01f )
{
VPROF_BUDGET( "C_ParticleSystem::ClientThink SkipToTime", "Particle Simulation" );
pEffect->SkipToTime( flTimeDelta );
}
}
}
}
}
示例2: ClientThink
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void C_ParticleSystem::ClientThink( void )
{
if ( m_bActive )
{
const char *pszName = GetParticleSystemNameFromIndex( m_iEffectIndex );
if ( pszName && pszName[0] )
{
CNewParticleEffect *pEffect = ParticleProp()->Create( pszName, PATTACH_ABSORIGIN_FOLLOW );
m_pEffect = pEffect;
if (pEffect)
{
for ( int i = 0 ; i < kMAXCONTROLPOINTS ; ++i )
{
CBaseEntity *pOnEntity = m_hControlPointEnts[i].Get();
if ( pOnEntity )
{
ParticleProp()->AddControlPoint( pEffect, i + 1, pOnEntity, PATTACH_ABSORIGIN_FOLLOW );
}
AssertMsg2( m_iControlPointParents[i] >= 0 && m_iControlPointParents[i] <= kMAXCONTROLPOINTS ,
"Particle system specified bogus control point parent (%d) for point %d.",
m_iControlPointParents[i], i );
if (m_iControlPointParents[i] != 0)
{
pEffect->SetControlPointParent(i+1, m_iControlPointParents[i]);
}
}
//server controlled control points (variables in particle effects instead of literal follow points)
for( int i = 0; i != ARRAYSIZE( m_iServerControlPointAssignments ); ++i )
{
if( m_iServerControlPointAssignments[i] != 255 )
{
pEffect->SetControlPoint( m_iServerControlPointAssignments[i], m_vServerControlPoints[i] );
}
else
{
break;
}
}
// Attach our particle snapshot if we have one
Assert( m_pSnapshot || !m_szSnapshotFileName[0] ); // m_szSnapshotFileName shouldn't change after the create update
if ( m_pSnapshot )
{
pEffect->SetControlPointSnapshot( 0, m_pSnapshot );
}
// NOTE: What we really want here is to compare our lifetime and that of our children and see if this delta is
// already past the end of it, denoting that we're finished. In that case, just destroy us and be done. -- jdw
// TODO: This can go when the SkipToTime code below goes
ParticleProp()->OnParticleSystemUpdated( pEffect, 0.0f );
// Skip the effect ahead if we're restarting it
float flTimeDelta = gpGlobals->curtime - m_flStartTime;
if ( flTimeDelta > 0.01f )
{
VPROF_BUDGET( "C_ParticleSystem::ClientThink SkipToTime", "Particle Simulation" );
pEffect->SkipToTime( flTimeDelta );
}
}
}
}
}