本文整理汇总了C++中TimedEvent::Init方法的典型用法代码示例。如果您正苦于以下问题:C++ TimedEvent::Init方法的具体用法?C++ TimedEvent::Init怎么用?C++ TimedEvent::Init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TimedEvent
的用法示例。
在下文中一共展示了TimedEvent::Init方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Start
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void C_ExtinguisherJet::Start( void )
{
SetupEntityRenderHandle( RENDER_GROUP_TRANSLUCENT_ENTITY );
m_ParticleSpawn.Init( 100 ); //Events per second
//Create the basic emitter
m_pEmitter = CSimpleEmitter::Create("C_ExtinguisherJet::m_pEmitter");
Assert( m_pEmitter.IsValid() );
if ( m_pEmitter.IsValid() )
{
m_MaterialHandle = m_pEmitter->GetPMaterial( "particle/particle_smokegrenade" );
m_pEmitter->SetSortOrigin( GetAbsOrigin() );
}
//Create the "ember" emitter for the smaller flecks
m_pEmberEmitter = CEmberEffect::Create( "C_ExtinguisherJet::m_pEmberEmitter" );
Assert( m_pEmberEmitter.IsValid() );
if ( m_pEmberEmitter.IsValid() )
{
m_EmberMaterialHandle = m_pEmberEmitter->GetPMaterial( "particle/particle_smokegrenade" );
m_pEmberEmitter->SetSortOrigin( GetAbsOrigin() );
}
}
示例2: OnDataChanged
//-----------------------------------------------------------------------------
// Purpose:
// Input : bnewentity -
//-----------------------------------------------------------------------------
void C_EntityFlame::OnDataChanged( DataUpdateType_t updateType )
{
if ( updateType == DATA_UPDATE_CREATED )
{
SetupEntityRenderHandle( RENDER_GROUP_TRANSLUCENT_ENTITY );
C_BaseEntity *pEnt = m_hEntAttached;
// FIXME: this should be IsBaseAnimating
if (pEnt->IsBaseCombatCharacter())
{
AttachToHitBoxes();
}
else
{
m_ParticleSpawn.Init( 60 ); //Events per second
m_pEmitter = CEmberEffect::Create("C_EntityFlame::Create");
Assert( m_pEmitter.IsValid() );
if ( m_pEmitter.IsValid() )
{
for ( int i = 1; i < NUM_FLAMELETS+1; i++ )
{
m_MaterialHandle[i-1] = m_pEmitter->GetPMaterial( VarArgs( "sprites/flamelet%d", i ) );
}
m_pEmitter->SetSortOrigin( GetAbsOrigin() );
}
}
}
}
示例3: Start
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void C_ExtinguisherJet::Start( void )
{
AddToLeafSystem( RENDER_GROUP_TRANSLUCENT_ENTITY );
m_ParticleSpawn.Init( 100 ); //Events per second
//Create the basic emitter
m_pEmitter = CSimpleEmitter::Create("C_ExtinguisherJet::m_pEmitter");
Assert( m_pEmitter.IsValid() );
if ( m_pEmitter.IsValid() )
{
m_MaterialHandle = g_Mat_DustPuff[0];
m_pEmitter->SetSortOrigin( GetAbsOrigin() );
}
//Create the "ember" emitter for the smaller flecks
m_pEmberEmitter = CEmberEffect::Create( "C_ExtinguisherJet::m_pEmberEmitter" );
Assert( m_pEmberEmitter.IsValid() );
if ( m_pEmberEmitter.IsValid() )
{
m_EmberMaterialHandle = g_Mat_DustPuff[0];
m_pEmberEmitter->SetSortOrigin( GetAbsOrigin() );
}
}
示例4: Start
//-----------------------------------------------------------------------------
// Purpose: Starts the effect
// Input : *pParticleMgr -
// *pArgs -
//-----------------------------------------------------------------------------
void C_SteamJet::Start(CParticleMgr *pParticleMgr, IPrototypeArgAccess *pArgs)
{
#ifdef GE_DLL
// If the client doesn't want the heat wave effect for explosions disable starting
if ( m_bIsForExplosion && cl_ge_noexpheatwave.GetBool() )
return;
#endif
pParticleMgr->AddEffect( &m_ParticleEffect, this );
switch(m_nType)
{
case STEAM_NORMAL:
default:
m_MaterialHandle = g_Mat_DustPuff[0];
break;
case STEAM_HEATWAVE:
m_MaterialHandle = m_ParticleEffect.FindOrAddMaterial("sprites/heatwave");
break;
}
m_ParticleSpawn.Init(m_Rate);
m_Lifetime = m_JetLength / m_Speed;
m_pParticleMgr = pParticleMgr;
UpdateLightingRamp();
}
示例5: Start
//-----------------------------------------------------------------------------
// Purpose: Starts the effect
// Input : *pParticleMgr -
// *pArgs -
//-----------------------------------------------------------------------------
void C_SmokeStack::Start(CParticleMgr *pParticleMgr, IPrototypeArgAccess *pArgs)
{
pParticleMgr->AddEffect( &m_ParticleEffect, this );
// Figure out the material name.
char str[512] = "unset_material";
const model_t *pModel = modelinfo->GetModel( m_iMaterialModel );
if ( pModel )
{
Q_strncpy( str, modelinfo->GetModelName( pModel ), sizeof( str ) );
// Get rid of the extension because the material system doesn't want it.
char *pExt = Q_stristr( str, ".vmt" );
if ( pExt )
pExt[0] = 0;
}
m_MaterialHandle[0] = m_ParticleEffect.FindOrAddMaterial( str );
int iCount = 1;
char szNames[512];
int iLength = Q_strlen( str );
str[iLength-1] = '\0';
Q_snprintf( szNames, sizeof( szNames ), "%s%d.vmt", str, iCount );
while ( filesystem->FileExists( VarArgs( "materials/%s", szNames ) ) && iCount < SMOKESTACK_MAX_MATERIALS )
{
char *pExt = Q_stristr( szNames, ".vmt" );
if ( pExt )
pExt[0] = 0;
m_MaterialHandle[iCount] = m_ParticleEffect.FindOrAddMaterial( szNames );
iCount++;
}
m_iMaxFrames = iCount-1;
m_ParticleSpawn.Init( mat_reduceparticles.GetBool() ? m_Rate / 4 : m_Rate ); // Obey mat_reduceparticles in episodic
m_InvLifetime = m_Speed / m_JetLength;
m_pParticleMgr = pParticleMgr;
// Figure out how we need to draw.
IMaterial *pMaterial = pParticleMgr->PMaterialToIMaterial( m_MaterialHandle[0] );
if( pMaterial )
{
m_Renderer.Init( pParticleMgr, pMaterial );
}
QueueLightParametersInRenderer();
// For the first N seconds, always simulate so it can build up the smokestack.
// Afterwards, we set it to freeze when it's not being rendered.
m_ParticleEffect.SetAlwaysSimulate( true );
SetNextClientThink( gpGlobals->curtime + 5 );
}
示例6: StartExplosion
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void C_HopwireExplosion::StartExplosion( void )
{
m_FXCoreScale.Init( 300.0f, 500.0f, 2.0f, INTERP_SPLINE );
m_FXCoreAlpha.Init( 0.0f, 0.1f, 1.5f, INTERP_SPLINE );
// Particle timer
m_ParticleTimer.Init( 60 );
}
示例7: Start
void C_ParticleFire::Start(CParticleMgr *pParticleMgr, IPrototypeArgAccess *pArgs)
{
m_pParticleMgr = pParticleMgr;
m_pParticleMgr->AddEffect( &m_ParticleEffect, this );
m_MaterialHandle = m_ParticleEffect.FindOrAddMaterial("particle/particle_fire");
// Start
m_nEmitters = 0;
m_EmitterSpawn.Init(15);
}
示例8: OnDataChanged
//-----------------------------------------------------------------------------
// Purpose:
// Input : updateType -
//-----------------------------------------------------------------------------
void C_AlyxEmpEffect::OnDataChanged( DataUpdateType_t updateType )
{
BaseClass::OnDataChanged( updateType );
if ( updateType == DATA_UPDATE_CREATED )
{
m_tParticleSpawn.Init( 32 );
SetNextClientThink( CLIENT_THINK_ALWAYS );
SetupEmitters();
}
}
示例9: Start
//-----------------------------------------------------------------------------
// Purpose:
// Input : *pParticleMgr -
// *pArgs -
//-----------------------------------------------------------------------------
void C_EntityParticleTrail::Start( )
{
if( ParticleMgr()->AddEffect( &m_ParticleEffect, this ) == false )
return;
const char *pMaterialName = GetMaterialNameFromIndex( m_iMaterialName );
if ( !pMaterialName )
return;
m_hMaterial = ParticleMgr()->GetPMaterial( pMaterialName );
m_teParticleSpawn.Init( 150 );
}
示例10: OnDataChanged
//-----------------------------------------------------------------------------
// Purpose:
// Input : bool -
//-----------------------------------------------------------------------------
void C_Flare::OnDataChanged( DataUpdateType_t updateType )
{
if ( updateType == DATA_UPDATE_CREATED )
{
SetSortOrigin( GetAbsOrigin() );
if ( m_bSmoke )
{
m_teSmokeSpawn.Init( 8 );
}
}
BaseClass::OnDataChanged( updateType );
}
示例11: OnDataChanged
//-----------------------------------------------------------------------------
// Purpose:
// Input : updateType -
//-----------------------------------------------------------------------------
void C_MortarShell::OnDataChanged( DataUpdateType_t updateType )
{
BaseClass::OnDataChanged( updateType );
if ( updateType == DATA_UPDATE_CREATED )
{
m_flStarttime = gpGlobals->curtime;
AddToLeafSystem( RENDER_GROUP_TRANSLUCENT_ENTITY );
m_pEmitter = CSimpleEmitter::Create( "C_EntityDissolve" );
m_pEmitter->SetSortOrigin( GetAbsOrigin() );
m_ParticleEvent.Init( 128 );
}
}
示例12: Start
//-----------------------------------------------------------------------------
// Purpose: Starts the effect
// Input : *pParticleMgr -
// *pArgs -
//-----------------------------------------------------------------------------
void C_SteamJet::Start(CParticleMgr *pParticleMgr, IPrototypeArgAccess *pArgs)
{
pParticleMgr->AddEffect( &m_ParticleEffect, this );
switch(m_nType)
{
case STEAM_NORMAL:
default:
m_MaterialHandle = m_ParticleEffect.FindOrAddMaterial("particle/particle_smokegrenade");
break;
case STEAM_HEATWAVE:
m_MaterialHandle = m_ParticleEffect.FindOrAddMaterial("sprites/heatwave");
break;
}
m_ParticleSpawn.Init(m_Rate);
m_Lifetime = m_JetLength / m_Speed;
m_pParticleMgr = pParticleMgr;
UpdateLightingRamp();
}
示例13: Start
//-----------------------------------------------------------------------------
// Purpose: Starts the effect
// Input : *pParticleMgr -
// *pArgs -
//-----------------------------------------------------------------------------
void C_SmokeStack::Start(CParticleMgr *pParticleMgr, IPrototypeArgAccess *pArgs)
{
pParticleMgr->AddEffect(&m_ParticleEffect, this);
// Figure out the material name.
char str[512] = "unset_material";
const model_t *pModel = modelinfo->GetModel(m_iMaterialModel);
if (pModel)
{
Q_strncpy(str, modelinfo->GetModelName(pModel), sizeof(str));
// Get rid of the extension because the material system doesn't want it.
char *pExt = Q_stristr(str, ".vmt");
if (pExt)
pExt[0] = 0;
}
m_MaterialHandle[0] = m_ParticleEffect.FindOrAddMaterial(str);
m_ParticleSpawn.Init( m_Rate );
m_InvLifetime = m_Speed / m_JetLength;
m_pParticleMgr = pParticleMgr;
// Figure out how we need to draw.
IMaterial *pMaterial = pParticleMgr->PMaterialToIMaterial( m_MaterialHandle[0] );
if( pMaterial )
{
m_Renderer.Init( pParticleMgr, pMaterial );
}
QueueLightParametersInRenderer();
// For the first N seconds, always simulate so it can build up the smokestack.
// Afterwards, we set it to freeze when it's not being rendered.
m_ParticleEffect.SetAlwaysSimulate( true );
SetNextClientThink( gpGlobals->curtime + 5 );
}
示例14: OnDataChanged
//-----------------------------------------------------------------------------
// Purpose: Called when data changes on the server
//-----------------------------------------------------------------------------
void C_Sparkler::OnDataChanged( DataUpdateType_t updateType )
{
// NOTE: We MUST call the base classes' implementation of this function
BaseClass::OnDataChanged( updateType );
// Setup our entity's particle system on creation
if ( updateType == DATA_UPDATE_CREATED )
{
// Creat the emitter
m_hEmitter = CSimpleEmitter::Create( "env_sparkler" );
// Obtain a reference handle to our particle's desired material
if ( m_hEmitter.IsValid() )
{
m_hMaterial = m_hEmitter->GetPMaterial( "effects/yellowflare" );
}
// Spawn 128 particles per second
m_tParticleTimer.Init( 128 );
// Call our ClientThink() function once every client frame
SetNextClientThink( CLIENT_THINK_ALWAYS );
}
}
示例15: Start
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void C_FireSmoke::Start( void )
{
// Setup the render handles for stuff we want in the client leaf list.
int i;
for ( i = 0; i < NUM_CHILD_FLAMES; i++ )
{
m_entFlames[i].SetupEntityRenderHandle( RENDER_GROUP_TRANSLUCENT_ENTITY );
}
//Various setup info
m_tParticleSpawn.Init( 10.0f );
QAngle offset;
model_t *pModel;
int maxFrames;
//Setup the child flames
for ( i = 0; i < NUM_CHILD_FLAMES; i++ )
{
//Setup our offset angles
offset[0] = 0.0f;
offset[1] = Helper_RandomFloat( 0, 360 );
offset[2] = 0.0f;
AngleVectors( offset, &m_entFlames[i].m_vecMoveDir );
pModel = (model_t *) modelinfo->GetModel( m_nFlameModelIndex );
maxFrames = modelinfo->GetModelFrameCount( pModel );
//Setup all the information for the client entity
m_entFlames[i].SetModelByIndex( m_nFlameModelIndex );
m_entFlames[i].SetLocalOrigin( GetLocalOrigin() );
m_entFlames[i].m_flFrame = Helper_RandomInt( 0.0f, maxFrames - 1 );
m_entFlames[i].m_flSpriteFramerate = Helper_RandomInt( 24, 30 );
m_entFlames[i].SetScale( m_flStartScale );
m_entFlames[i].m_nRenderMode = kRenderTransAdd;
m_entFlames[i].m_nRenderFX = kRenderFxNone;
m_entFlames[i].SetRenderColor( 255, 255, 255, 255 );
m_entFlames[i].SetBrightness( 255 );
m_entFlames[i].index = -1;
if ( i == 0 )
{
m_entFlameScales[i] = 1.0f;
}
else
{
//Keep a scale offset
m_entFlameScales[i] = 1.0f - ( ( (float) i / (float) NUM_CHILD_FLAMES ) );
}
}
//Only make the glow if we've requested it
if ( m_nFlags & bitsFIRESMOKE_GLOW )
{
//Create the fire overlay
if ( m_pFireOverlay = new CFireOverlay( this ) )
{
m_pFireOverlay->m_vPos = GetAbsOrigin();
m_pFireOverlay->m_nSprites = 1;
m_pFireOverlay->m_vBaseColors[0].Init( 0.4f, 0.2f, 0.05f );
m_pFireOverlay->Activate();
}
}
}