RuneI
Class SonicBlast

source: c:\runehov\RuneI\Classes\SonicBlast.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Effects
         |
         +--RuneI.SonicBlast
Direct Known Subclasses:None

class SonicBlast
extends Engine.Effects

//============================================================================= // SonicBlast. //=============================================================================
Variables
 Texture BlastTex[4]
           In order from full --> faded out
 int TexStage
           In order from full --> faded out
 float Time
           In order from full --> faded out


Function Summary
 
simulated
ChangeBlastTexture()
 
simulated
Spawned()
 
simulated
Tick(float DeltaTime)



Source Code


00001	//=============================================================================
00002	// SonicBlast.
00003	//=============================================================================
00004	class SonicBlast expands Effects;
00005	
00006	const TimeStep = 0.1;
00007	
00008	var() texture BlastTex[4]; // In order from full --> faded out
00009	
00010	var float Time;
00011	var int TexStage;
00012	
00013	simulated function Spawned()
00014	{
00015		Time = 0;
00016		TexStage = 0;
00017		Texture = BlastTex[3];
00018	}
00019	
00020	simulated function ChangeBlastTexture()
00021	{
00022		TexStage++;
00023	
00024		if(TexStage >= 7)
00025		{
00026			Destroy(); // Remove the sonic effect after a certain time
00027			return;
00028		}
00029		
00030		switch(TexStage)
00031		{
00032		case 0: case 6:
00033			Texture = BlastTex[3];
00034			break;
00035		case 1: case 5:
00036			Texture = BlastTex[2];
00037			break;
00038		case 2: case 4:
00039			Texture = BlastTex[1];
00040			break;
00041		case 3:
00042			Texture = BlastTex[0];
00043			break;
00044		default:
00045			Texture = BlastTex[3];
00046			break;
00047		}
00048	
00049	}
00050	
00051	simulated function Tick(float DeltaTime)
00052	{
00053		local float newRadius;
00054		local vector loc;
00055		local rotator rot;
00056	
00057		DrawScale += DeltaTime * DrawScale * 2;
00058			
00059		rot = Rotation;
00060		rot.Roll += 50000 * DeltaTime / (DrawScale * 0.25);
00061		SetRotation(rot);
00062		
00063		Time += DeltaTime;
00064		while(Time >= TimeStep)
00065		{
00066			Time -= TimeStep;
00067			ChangeBlastTexture();
00068		}
00069	}
00070	
00071	defaultproperties
00072	{
00073	     BlastTex(0)=Texture'RuneFX.sonicmod'
00074	     BlastTex(1)=Texture'RuneFX.sonicmodfade1'
00075	     BlastTex(2)=Texture'RuneFX.sonicmodfade2'
00076	     BlastTex(3)=Texture'RuneFX.sonicmodfade3'
00077	     RemoteRole=ROLE_SimulatedProxy
00078	     DrawType=DT_VerticalSprite
00079	     Style=STY_Modulated
00080	     Texture=Texture'RuneFX.sonicmod'
00081	     bUnlit=True
00082	}

End Source Code