class XEnergy expands CyBot
abstract;

#exec AUDIO IMPORT NAME="Cybot_X_Ambient" FILE=SOUNDS\Cybot_X_Ambient.wav GROUP="Cybot"

var bool bReady;
var() bool bTimedEffect;
var() float EffectRefreshTime;
var() sound EffectSound;
var() class<XEnergyParticles> EnergyParticlesType;
var XEnergyParticles xep[3];

var float Count;
var byte ParticleN;

simulated function PostBeginPlay()
{
	Velocity = vect(0,0,15);
	SetTimer(2.0, False);
}

simulated function Tick( float DeltaTime)
{
	if (ParticleN < 3)
	{
		Count += DeltaTime;

		if (Count >= 0.33)
		{
			Count = 0;
			xep[ParticleN] = Spawn(EnergyParticlesType, Self);
			ParticleN++;
		}
	}
}

simulated function Timer()
{
	if (!bReady)
	{
		bReady = True;
		Velocity = vect(0,0,0);
		SetPhysics(PHYS_Rotating);

		if (bTimedEffect && EffectRefreshTime > 0)
		{
			SetTimer(EffectRefreshTime, True);
			return;
		}

		ReleaseEffect();
	}
}

function MakeSound()
{
	if (EffectSound != None)
		PlaySound(EffectSound,,12.0,,1800);
}

simulated function ReleaseEffect()
{
	//Handled by the subclasses
}


simulated function Destroyed()
{
local byte i;

	For (i=0; i<3; i++)
	{
		if (xep[i] != None)
			xep[i].Destroy();
	}
	
	Super.Destroyed();
}

defaultproperties
{
	DrawType=DT_Sprite
	Physics=PHYS_Projectile
	RemoteRole=ROLE_SimulatedProxy
	Texture=None
	AmbientSound=Cybot_X_Ambient
	SoundVolume=120
	SoundRadius=100
	DrawScale=0.500000
	Style=STY_Translucent
	bUnlit=True
	SpriteProjForward=2.000000
	bFixedRotationDir=True
	RotationRate=(Yaw=20000)
}
