//=============================================================================
// SkaarjProjectile.
//=============================================================================
class SkaarjProjectile expands Projectile;

#exec TEXTURE IMPORT NAME=ExplosionPal FILE=textures\exppal.pcx GROUP=Effects
#exec OBJ LOAD FILE=textures\SkaarjP.utx PACKAGE=UNREALI

#exec AUDIO IMPORT FILE="Sounds\Skaarj\skasht2.WAV" NAME="Skrjshot" GROUP="Skaarj"
#exec AUDIO IMPORT FILE="Sounds\Skaarj\skaimp3.WAV" NAME="SkrjImp" GROUP="Skaarj"

auto state Flying
{

	simulated function Timer()
	{
		Texture = Texture'Skj_a04';
	}

	function ProcessTouch (Actor Other, Vector HitLocation)
	{
		local vector momentum;
	
		if ((SkaarjWarrior(Other) == None) && (SkaarjProjectile(Other) == None))
		{
			momentum = 10000.0 * Normal(Velocity);
			Other.Damage(Damage, instigator, HitLocation, momentum, 'zapped');
			Destroy();
		}
	}
	
	function Explode(vector HitLocation, vector HitNormal)
	{
		PlaySound(ImpactSound);
		spawn(class 'EnergyBurst',,,HitLocation+HitNormal*9);
		destroy();
	}

	function BeginState()
	{
		if ( ScriptedPawn(Instigator) != None )
			Speed = ScriptedPawn(Instigator).ProjectileSpeed;
		Velocity = Vector(Rotation) * speed;
		PlaySound(SpawnSound);
	}

Begin:
	SetTimer(0.20,False);
	Sleep(7.0); //self destruct after 7.0 seconds
	Explode(Location, vect(0,0,0));
}

