RuneI
Class Splash

source: c:\runehov\RuneI\Classes\splash.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.ParticleSystem
         |
         +--RuneI.Splash
Direct Known Subclasses:WaterFallSplash

class Splash
extends Engine.ParticleSystem

//============================================================================= // Splash. //=============================================================================
Variables
 int RippleDelay
           Keeps track of how long it has been since we have been allowed to create a ripple


Function Summary
 
simulated
SystemInit()
 
simulated
Tick(float DeltaTime)



Source Code


00001	//=============================================================================
00002	// Splash.
00003	//=============================================================================
00004	class Splash expands ParticleSystem;
00005	//You can change the type of Ripple if you need a different one (e.g. for Mud instead....) 
00006	//NOTE: Keep RippleChance low, or you may have too much overhead if things get busy... mc
00007	
00008	var(Splash) class<Ripple> SpawnRipple; //Which type of ripple to spawn on contact.
00009	var(Splash) int NumTextures; //Number of textures to randomly pick from.
00010	var(Splash) int RippleChance;  //Create a ripple every Nth time...
00011	
00012	var int RippleDelay; //Keeps track of how long it has been since we have been allowed to create a ripple
00013	
00014	simulated function SystemInit()
00015	{
00016		local int i;
00017			
00018		for (i=0; i<ParticleCount; i++)
00019		{
00020			ParticleArray[i].Valid = True;
00021			ParticleArray[i].Velocity.X = VelocityMin.X + (VelocityMax.X-VelocityMin.X)*FRand();
00022			ParticleArray[i].Velocity.Y = VelocityMin.Y + (VelocityMax.Y-VelocityMin.Y)*FRand();
00023			ParticleArray[i].Velocity.Z = VelocityMin.Z + (VelocityMax.Z-VelocityMin.Z)*FRand();
00024			
00025	 		ParticleArray[i].Alpha = vect(1,1,1)*AlphaStart;
00026			ParticleArray[i].LifeSpan = LifeSpanMin + (LifeSpanMax-LifeSpanMin)*FRand();
00027			
00028			
00029			ParticleArray[i].TextureIndex = NumTextures * FRand();
00030			ParticleArray[i].Style = Style;
00031	
00032			ParticleArray[i].Location = Location;
00033	
00034			ParticleArray[i].ScaleStartX = 0.15;
00035			ParticleArray[i].ScaleStartY = 0.15;
00036			ParticleArray[i].XScale = 0.15;
00037			ParticleArray[i].YScale = 0.15;
00038		}
00039	
00040		RippleDelay = 0;
00041		IsLoaded=true;
00042	}
00043	
00044	
00045	
00046	simulated function Tick(float DeltaTime)
00047	{
00048		local int i;
00049	
00050		
00051		for (i=0; i<ParticleCount; i++)
00052		{
00053			if(ParticleArray[i].Valid)
00054			 {
00055			 		//Update Location
00056		     ParticleArray[i].Location =
00057		        ParticleArray[i].Location + (ParticleArray[i].Velocity * DeltaTime);
00058		    	 
00059		    	 	//If at level of the spawner AND velocity is downward, invalidate and cause ripple..
00060		     if(ParticleArray[i].Velocity.Z < 0 && ParticleArray[i].Location.Z < Location.Z)
00061		     {
00062		      ParticleArray[i].Valid = False;
00063		    	  
00064		      //Check to see if it is okay to create a ripple yet (minimizes overhead of too many actors)
00065		      if(++RippleDelay >= RippleChance)
00066		      {
00067		       spawn(SpawnRipple, self, , ParticleArray[i].Location, rot(0,0,0));
00068		       RippleDelay = 0;
00069		      }
00070		     }
00071			}
00072		}//End For-Loop
00073	}
00074	
00075	defaultproperties
00076	{
00077	     SpawnRipple=Class'RuneI.DropRipple'
00078	     NumTextures=4
00079	     RippleChance=4
00080	     bSystemOneShot=True
00081	     ParticleCount=40
00082	     ParticleTexture(0)=Texture'RuneFX.splash1'
00083	     ParticleTexture(1)=Texture'RuneFX.splash2'
00084	     ParticleTexture(2)=Texture'RuneFX.splash3'
00085	     ParticleTexture(3)=Texture'RuneFX.splash4'
00086	     bRandomTexture=True
00087	     ShapeVector=(X=10.000000,Y=10.000000,Z=4.000000)
00088	     VelocityMin=(X=-50.000000,Y=-50.000000,Z=60.000000)
00089	     VelocityMax=(X=50.000000,Y=50.000000,Z=120.000000)
00090	     ScaleMin=0.400000
00091	     ScaleMax=0.500000
00092	     ScaleDeltaX=0.200000
00093	     ScaleDeltaY=0.300000
00094	     LifeSpanMin=1.000000
00095	     LifeSpanMax=1.000000
00096	     AlphaStart=250
00097	     AlphaEnd=115
00098	     bAlphaFade=True
00099	     bApplyGravity=True
00100	     GravityScale=0.250000
00101	     bApplyZoneVelocity=True
00102	     bWaterOnly=True
00103	     bOneShot=True
00104	     SpawnOverTime=0.500000
00105	     bEventSystemInit=True
00106	     bStasis=False
00107	     Style=STY_Translucent
00108	}

End Source Code