예제 #1
0
//-----------------------------------------------------------------------------
// Purpose: 
// Output : SmokeTrail*
//-----------------------------------------------------------------------------
SmokeTrail* SmokeTrail::CreateSmokeTrail()
{
	CBaseEntity *pEnt = CreateEntityByName(SMOKETRAIL_ENTITYNAME);
	if(pEnt)
	{
		SmokeTrail *pSmoke = dynamic_cast<SmokeTrail*>(pEnt);
		if(pSmoke)
		{
			pSmoke->Activate();
			return pSmoke;
		}
		else
		{
			UTIL_Remove(pEnt);
		}
	}

	return NULL;
}
//------------------------------------------------------------------------------
// Purpose :
//------------------------------------------------------------------------------
void CPlayer_Missile::Launch(void)
{
	m_lifeState		= LIFE_ALIVE;
	m_takedamage	= DAMAGE_YES;
	m_iHealth		= m_iMaxHealth;

	// Shoot forward
	Vector vVelocity; 
	AngleVectors( GetLocalAngles(), &vVelocity);
	SetAbsVelocity( vVelocity*PMISSILE_SPEED );

	EmitSound( "Player_Manhack.Fly" );
	EmitSound( "Player_Manhack.Fire" );


	SetThink(FlyThink);
	SetTouch(FlyTouch);
	SetNextThink( gpGlobals->curtime );

	// Start smoke trail
	SmokeTrail *pSmokeTrail = SmokeTrail::CreateSmokeTrail();
	if(pSmokeTrail)
	{
		pSmokeTrail->m_SpawnRate = 90;
		pSmokeTrail->m_ParticleLifetime = PMISSILE_TRAIL_LIFE;
		pSmokeTrail->m_StartColor.Init(0.1, 0.1, 0.1);
		pSmokeTrail->m_EndColor.Init(0.5,0.5,0.5);
		pSmokeTrail->m_StartSize = 10;
		pSmokeTrail->m_EndSize = 50;
		pSmokeTrail->m_SpawnRadius = 1;
		pSmokeTrail->m_MinSpeed = 15;
		pSmokeTrail->m_MaxSpeed = 25;
		pSmokeTrail->SetLifetime(120);
		pSmokeTrail->FollowEntity(ENTINDEX(pev));

		m_hSmokeTrail = pSmokeTrail;
	}
}