class NuclearExplosionII expands NuclearExplSets;

#exec AUDIO IMPORT NAME="UltimaExplosion" FILE=SOUNDS\UltimaExplosion.wav GROUP="UltimaProtos"

var byte EffectsTiming;
var float Timing;
var float MainCount;
var bool EventA, EventB, EventC, EventD, EventE, EventF, EventG;

simulated function PostBeginPlay()
{
	Spawn(Class'CoronaNukeC',,, Location + vect(0,0,280));
	//Spawn(Class'X_NukeCoronaC',,, Location + vect(0,0,280));
	ClientFlashes();
	SetTimer(0.8, True);
	SpawnShock();
	SpawnAkira();
	MakeSound();
}

function SpawnShock()
{
	Spawn(Class'NuclearShockII');
}

function SpawnBiggerShock()
{
	Spawn(Class'NuclearShockIII');
}

function SpawnAkira()
{
	Spawn(Class'BigShockwaveII',,,, rot(16384,0,0));
}

function MakeSound()
{
	PlaySound (Sound'UltimaExplosion', SLOT_Interface, 255.0, True, 30000.0);
	PlaySound (Sound'UltimaExplosion', SLOT_None, 255.0, True, 30000.0);
	PlaySound (Sound'UltimaExplosion', SLOT_Misc, 255.0, True, 30000.0);
	PlaySound (Sound'UltimaExplosion', SLOT_Talk, 255.0, True, 30000.0);
}

simulated function Timer()
{
	if (MainCount <= 20.8 && Role == ROLE_Authority)
		Spawn(Class'NukeDustRotCol');
}

simulated function Tick( float DeltaTime)
{
	MainCount += DeltaTime;

	if (MainCount >= 9 && !EventA)
	{
		EventA = True;
		ClientFlashes();
		SpawnShock();
	}

	if (MainCount >= 25.75 && !EventB)
	{
		EventB = True;
		ClientFlashes();
		Spawn(Class'CoronaNukeD');
		//Spawn(Class'X_NukeCoronaD');
		SpawnBiggerShock();

		if (Role == ROLE_Authority)
			Spawn(Class'FinalRedShock',,, Location + vect(0,0,8), rot(16384,0,0));
	}

	if (MainCount >= 6 && !EventC)
	{
		EventC = True;
		if (Role == ROLE_Authority)
			Spawn(Class'NuclearRingUpII',,, Location + vect(0,0,1152), rot(-16384,0,0));
	}
	if (MainCount >= 10 && !EventD)
	{
		EventD = True;
		if (Role == ROLE_Authority)
			Spawn(Class'NuclearRingUpII',,, Location + vect(0,0,1920), rot(-16384,0,0));
	}
	if (MainCount >= 14 && !EventE)
	{
		EventE = True;
		if (Role == ROLE_Authority)
			Spawn(Class'NuclearRingUpII',,, Location + vect(0,0,2688), rot(-16384,0,0));
	}
	if (MainCount >= 18 && !EventF)
	{
		EventF = True;
		if (Role == ROLE_Authority)
			Spawn(Class'NuclearRingUpII',,, Location + vect(0,0,3456), rot(-16384,0,0));
	}
	if (MainCount >= 22 && !EventG)
	{
		EventG = True;
		if (Role == ROLE_Authority)
			Spawn(Class'NuclearRingUpII',,, Location + vect(0,0,4224), rot(-16384,0,0));
	}
}

simulated function ClientFlashes()
{
local Vector EndFlashFog;
local float f;
local PlayerPawn p;

	//EndFlashFog.X=1;	EndFlashFog.Y=3;	EndFlashFog.Z=0;
	EndFlashFog.X=180;	EndFlashFog.Y=1;	EndFlashFog.Z=0;

	ForEach VisibleActors( class'PlayerPawn', p)
		p.ClientFlash( 2, 1000*EndFlashFog );
}



defaultproperties
{
	Texture=GravityLight
	DrawScale=0.200000
	LifeSpan=30.000000
	RemoteRole=ROLE_SimulatedProxy
	bHidden=True
	bNetTemporary=False
	NetPriority=2.000000
	bAlwaysRelevant=True
}