本文整理汇总了C++中CNewParticleEffect::SetOwner方法的典型用法代码示例。如果您正苦于以下问题:C++ CNewParticleEffect::SetOwner方法的具体用法?C++ CNewParticleEffect::SetOwner怎么用?C++ CNewParticleEffect::SetOwner使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CNewParticleEffect
的用法示例。
在下文中一共展示了CNewParticleEffect::SetOwner方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: StopEmissionAndDestroyImmediately
//-----------------------------------------------------------------------------
// Purpose: Remove effects immediately, including all current particles. If no
// effect is specified, all effects attached to this entity are removed.
//-----------------------------------------------------------------------------
void CParticleProperty::StopEmissionAndDestroyImmediately( CNewParticleEffect *pEffect )
{
if ( pEffect )
{
int iIndex = FindEffect( pEffect );
//Assert( iIndex != -1 );
if ( iIndex != -1 )
{
m_ParticleEffects.Remove( iIndex );
// Clear the owner so it doesn't try to call back to us on deletion
pEffect->SetOwner( NULL );
pEffect->StopEmission( false, true );
}
}
else
{
// Immediately destroy all effects
int nCount = m_ParticleEffects.Count();
for ( int i = nCount-1; i >= 0; i-- )
{
CNewParticleEffect *pTmp = m_ParticleEffects[i].pParticleEffect.GetObject();
m_ParticleEffects.Remove( i );
// Clear the owner so it doesn't try to call back to us on deletion
pTmp->SetOwner( NULL );
pTmp->StopEmission( false, true );
}
}
}
示例2: StopEmission
//-----------------------------------------------------------------------------
// Purpose: Stop effects from emitting more particles. If no effect is
// specified, all effects attached to this entity are stopped.
//-----------------------------------------------------------------------------
void CParticleProperty::StopEmission( CNewParticleEffect *pEffect, bool bWakeOnStop, bool bDestroyAsleepSystems )
{
// If we return from dormancy and are then told to stop emitting,
// we should have died while dormant. Remove ourselves immediately.
bool bRemoveInstantly = (m_iDormancyChangedAtFrame == gpGlobals->framecount);
if ( pEffect )
{
if ( FindEffect( pEffect ) != -1 )
{
pEffect->StopEmission( false, bRemoveInstantly, bWakeOnStop );
}
}
else
{
// Stop all effects
float flNow = g_pParticleSystemMgr->GetLastSimulationTime();
int nCount = m_ParticleEffects.Count();
for ( int i = nCount-1; i >= 0; i-- )
{
CNewParticleEffect *pTmp = m_ParticleEffects[i].pParticleEffect.GetObject();
bool bRemoveSystem = bRemoveInstantly || ( bDestroyAsleepSystems && ( flNow >= pTmp->m_flNextSleepTime ) );
if ( bRemoveSystem )
{
m_ParticleEffects.Remove( i );
pTmp->SetOwner( NULL );
}
pTmp->StopEmission( false, bRemoveSystem, !bRemoveSystem && bWakeOnStop );
}
}
}