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


C++ TimedEvent类代码示例

本文整理汇总了C++中TimedEvent的典型用法代码示例。如果您正苦于以下问题:C++ TimedEvent类的具体用法?C++ TimedEvent怎么用?C++ TimedEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: lock

int Update::registerEvent(boost::posix_time::time_duration time, gameplay::EventAction eventAction)
{
    boost::lock_guard<boost::mutex> lock(eventMutex);
    TimedEvent* event = new TimedEvent(time, eventAction);
    event->init();
    timedEvents[event->getID()] = event;
    return event->getID();
}
开发者ID:ChadMcKinney,项目名称:Entropy,代码行数:8,代码来源:update.cpp

示例2: return

/* Call timed event at front of queue, whose time is <= `now'.
 * Returns true if an event handler was called. (false if time isn't up yet)
 */
bool TimeQueue::call_timer(uint32 now)
{
    if(empty())
        return(false);
    TimedEvent *tevent = tq.front();
    if(tevent->defunct)
    {
        assert(pop_timer() == tevent);
        delete_timer(tevent);
        return(false);
    }
    if(tevent->time > now)
        return(false);

    //dequeue event here
    pop_timer(); // remove timer in case we have recursion in the timed() call.

    tevent->timed(now); // fire

    //re-queue if repeating timer.

    if(tevent->repeat_count != 0) // repeat! same delay, add time
    {
        // use updated time so it isn't repeated too soon
        tevent->set_time();
//            tevent->time = clock->get_ticks() + tevent->delay;
//            tevent->time = now + tevent->delay;
        add_timer(tevent);
        if(tevent->repeat_count > 0) // don't reduce count if infinite (-1)
            --tevent->repeat_count;
    }
    else
        delete_timer(tevent); // if not repeated, safe to delete

    return(true);
}
开发者ID:nuvie,项目名称:nuvie,代码行数:39,代码来源:TimedEvent.cpp

示例3: 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() );
			}
		}
	}
}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:36,代码来源:c_fire_smoke.cpp

示例4: Update

//-----------------------------------------------------------------------------
// Purpose: 
// Input  : fTimeDelta - 
//-----------------------------------------------------------------------------
void C_Plasma::Update( void )
{
	//Update all our parts
	UpdateScale();
	UpdateAnimation();
	UpdateFlames();

	if (m_flScaleRegister > 0.1)
	{
		float tempDelta = gpGlobals->frametime;
		while( m_tDecalSpawn.NextEvent( tempDelta ) )
		{
			// Add decal to floor
			C_BaseEntity *ent = cl_entitylist->GetEnt( 0 );
			if ( ent )
			{
				int index = decalsystem->GetDecalIndexForName( "PlasmaGlowFade" );
				if ( index >= 0 )
				{
					effects->DecalShoot( index, 0, ent->GetModel(), ent->GetAbsOrigin(), ent->GetAbsAngles(), GetAbsOrigin(), 0, 0 );
				}
			}
		}
	}
}
开发者ID:BenLubar,项目名称:SwarmDirector2,代码行数:29,代码来源:c_plasma.cpp

示例5: Update

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void C_FireSmoke::Update( void )
{
	//If we haven't already, find the clip plane for smoke effects
	if ( ( m_nFlags & bitsFIRESMOKE_SMOKE ) && ( m_bClipTested == false ) )
	{
		FindClipPlane();
	}

	//Update all our parts
	UpdateEffects();
	UpdateScale();
	UpdateAnimation();
	UpdateFlames();

	//See if we should emit smoke
	if ( m_nFlags & bitsFIRESMOKE_SMOKE )
	{
		float tempDelta = Helper_GetFrameTime();

		while( m_tParticleSpawn.NextEvent( tempDelta ) )
		{
			SpawnSmoke();
		}
	}
}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:28,代码来源:c_fire_smoke.cpp

示例6: 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();
}
开发者ID:Entropy-Soldier,项目名称:ges-legacy-code,代码行数:34,代码来源:c_steamjet.cpp

示例7: 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() );
	}
}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:29,代码来源:c_extinguisher.cpp

示例8: ClientThink

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void C_ObjectEMPGenerator::ClientThink( void )
{
	// Add particles at the target.
	float flCur = gpGlobals->frametime;
	while ( m_ParticleEvent.NextEvent( flCur ) )
	{
		Vector vPos = WorldSpaceCenter( );
		Vector vOffset = RandomVector( -1, 1 );
		VectorNormalize( vOffset );
		vPos += vOffset * RandomFloat( 0, 50 );
		
		SimpleParticle *pParticle = m_pEmitter->AddSimpleParticle( m_hParticleMaterial, vPos );
		if ( pParticle )
		{
			// Move the points along the path.
			pParticle->m_vecVelocity.Init();
			pParticle->m_flRoll = 0;
			pParticle->m_flRollDelta = 0;
			pParticle->m_flDieTime = 0.4f;
			pParticle->m_flLifetime = 0;
			pParticle->m_uchColor[0] = 255; 
			pParticle->m_uchColor[1] = 255;
			pParticle->m_uchColor[2] = 255;
			pParticle->m_uchStartAlpha = 32;
			pParticle->m_uchEndAlpha = 0;
			pParticle->m_uchStartSize = 6;
			pParticle->m_uchEndSize = 4;
			pParticle->m_iFlags = 0;
		}
	}
}
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:34,代码来源:c_obj_empgenerator.cpp

示例9: 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() );
	}
}
开发者ID:SCell555,项目名称:source-sdk-2013,代码行数:29,代码来源:c_extinguisher.cpp

示例10: 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 );
}
开发者ID:TalonBraveInfo,项目名称:InvasionSource,代码行数:64,代码来源:c_smokestack.cpp

示例11: 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 );
}
开发者ID:KyleGospo,项目名称:City-17-Episode-One-Source-2013,代码行数:11,代码来源:c_weapon_hopwire.cpp

示例12: Update

//-----------------------------------------------------------------------------
// Purpose: 
// Input  : fTimeDelta - 
//-----------------------------------------------------------------------------
void C_SmokeStack::Update(float fTimeDelta)
{
    if (!m_pParticleMgr)
    {
        assert(false);
        return;
    }

    // Don't spawn particles unless we're visible.
    if (m_bEmit && (m_ParticleEffect.WasDrawnPrevFrame() || m_ParticleEffect.GetAlwaysSimulate()))
    {
        // Add new particles.																	
        Vector forward, right, up;
        AngleVectors(GetAbsAngles(), &forward, &right, &up);

        float tempDelta = fTimeDelta;
        while (m_ParticleSpawn.NextEvent(tempDelta))
        {
            int iRandomFrame = random->RandomInt(0, m_iMaxFrames);

            iRandomFrame = 0;

            // Make a new particle.
            if (SmokeStackParticle *pParticle = (SmokeStackParticle*) m_ParticleEffect.AddParticle(sizeof(SmokeStackParticle), m_MaterialHandle[iRandomFrame]))
            {
                float angle = FRand(0, 2.0f*M_PI_F);

                pParticle->m_Pos = GetAbsOrigin() +
                    right * (cos(angle) * m_flBaseSpread) +
                    forward * (sin(angle) * m_flBaseSpread);

                pParticle->m_Velocity =
                    FRand(-m_SpreadSpeed, m_SpreadSpeed) * right +
                    FRand(-m_SpreadSpeed, m_SpreadSpeed) * forward +
                    m_Speed * up;

                pParticle->m_vAccel = m_vWind;
                pParticle->m_Lifetime = 0;
                pParticle->m_flAngle = 0.0f;

                pParticle->m_flRollDelta = random->RandomFloat(-m_flRollSpeed, m_flRollSpeed);
                pParticle->m_flSortPos = pParticle->m_Pos.z;
            }
        }
    }

    // Setup the twist matrix.
    float flTwist = (m_flTwist * (M_PI_F * 2.f) / 360.0f) * Helper_GetFrameTime();
    if ((m_bTwist = !!flTwist))
    {
        m_TwistMat[0][0] = cos(flTwist);
        m_TwistMat[0][1] = sin(flTwist);
        m_TwistMat[1][0] = -sin(flTwist);
        m_TwistMat[1][1] = cos(flTwist);
    }

    QueueLightParametersInRenderer();
}
开发者ID:Yosam02,项目名称:game,代码行数:62,代码来源:c_smokestack.cpp

示例13: 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);
}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:10,代码来源:c_particle_fire.cpp

示例14: Update

//-----------------------------------------------------------------------------
// Purpose:
// Input  : fTimeDelta -
//-----------------------------------------------------------------------------
void C_EntityParticleTrail::Update( float fTimeDelta )
{
    float tempDelta = fTimeDelta;
    studiohdr_t *pStudioHdr;
    mstudiohitboxset_t *set;
    matrix3x4_t	*hitboxbones[MAXSTUDIOBONES];

    C_BaseEntity *pMoveParent = GetMoveParent();
    if ( !pMoveParent )
        return;

    C_BaseAnimating *pAnimating = pMoveParent->GetBaseAnimating();
    if (!pAnimating)
        goto trailNoHitboxes;

    if ( !pAnimating->HitboxToWorldTransforms( hitboxbones ) )
        goto trailNoHitboxes;

    pStudioHdr = modelinfo->GetStudiomodel( pAnimating->GetModel() );
    if (!pStudioHdr)
        goto trailNoHitboxes;

    set = pStudioHdr->pHitboxSet( pAnimating->GetHitboxSet() );
    if ( !set )
        goto trailNoHitboxes;

    //Add new particles
    while ( m_teParticleSpawn.NextEvent( tempDelta ) )
    {
        int nHitbox = random->RandomInt( 0, set->numhitboxes - 1 );
        mstudiobbox_t *pBox = set->pHitbox(nHitbox);

        AddParticle( tempDelta, pBox->bbmin, pBox->bbmax, *hitboxbones[pBox->bone] );
    }
    return;

trailNoHitboxes:
    while ( m_teParticleSpawn.NextEvent( tempDelta ) )
    {
        AddParticle( tempDelta, pMoveParent->CollisionProp()->OBBMins(), pMoveParent->CollisionProp()->OBBMaxs(), pMoveParent->EntityToWorldTransform() );
    }
}
开发者ID:BenLubar,项目名称:SwarmDirector2,代码行数:46,代码来源:c_entityparticletrail.cpp

示例15: 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();
	}
}
开发者ID:AluminumKen,项目名称:hl2sb-src,代码行数:15,代码来源:c_env_alyxtemp.cpp


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