示例#1
0
//-----------------------------------------------------------------------------
// 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();
		}
	}
}
bool hhHarvesterSimple::Pain( idEntity *inflictor, idEntity *attacker, int damage, const idVec3 &dir, int location ) {
	int preDeathThresh = spawnArgs.GetInt("predeath_thresh", "-1");	
	if(allowPreDeath && !bGibOnDeath && preDeathThresh > 0 && health < preDeathThresh) {
		allowPreDeath = false;	// We've tried, cannot try anymore
		float preDeathFreq = spawnArgs.GetFloat("predeath_freq", "1");
		if(gameLocal.random.RandomFloat() < preDeathFreq) {
            ProcessEvent(&MA_StartPreDeath);
		}
	}

	if ( bSmokes ) {
		if ( !fxSmoke[0].IsValid() && health <= AI_PASSAGEWAY_HEALTH ) {
			SpawnSmoke();
		} else if (fxSmoke[0].IsValid() && health > AI_PASSAGEWAY_HEALTH)  {
			ClearSmoke();
		}
	}
	
	return( idAI::Pain(inflictor, attacker, damage, dir, location) );
}