UnrealShare
Class SmokeHose

source: e:\games\UnrealTournament\UnrealShare\Classes\SmokeHose.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Effects
         |
         +--UnrealShare.SmokeHose
Direct Known Subclasses:None

class SmokeHose
extends Engine.Effects

//============================================================================= // SmokeHose. //=============================================================================
Variables
 float BasePuffSize
 int NumPuffsSpawned
 float SizeVariance
 Vector SmokeAccel
 float SmokeDelay
 float SmokeDelayVariance
 Actor SmokeDestObj
 float SmokeSpeed
 float SpeedVariance
 int TotalNumPuffs
 bool bInitiallyActive


Function Summary
 void BeginPlay()
 void Timer()
 void Trigger(Actor Other, Pawn EventInstigator)
 void UnTrigger(Actor Other, Pawn EventInstigator)



Source Code


00001	//=============================================================================
00002	// SmokeHose.
00003	//=============================================================================
00004	class SmokeHose extends Effects;
00005	
00006	// Shoots out a stream of RisingSpriteSmokePuffs.  The smoke sprites are shot
00007	// in the direction of the SmokeHoseDest actor with the same Tag as this actors
00008	// Event.  The speed, speedvariance, spawning delay and variance, size and
00009	// size variance, as well as the acceleration of the smoke puffs are adjustable.
00010	// The effect can be initially active all the time, or enabled when the player
00011	// is within a trigger's radius.
00012	
00013	var() bool   bInitiallyActive;
00014	var() float  SmokeSpeed;
00015	var() Vector SmokeAccel;
00016	var() float  SmokeDelay;
00017	var() float  SmokeDelayVariance;
00018	var() float  SpeedVariance;
00019	var() float  BasePuffSize;
00020	var() float  SizeVariance;
00021	var() int    TotalNumPuffs;
00022	
00023	var Actor    SmokeDestObj;
00024	var int	    NumPuffsSpawned;
00025	
00026	function BeginPlay()
00027	{
00028		local SmokeHoseDest SDest;
00029	
00030		// Find the SmokeHoseDest object which has the same tag as
00031		// the event of this SmokeHose.
00032		foreach AllActors( class 'SmokeHoseDest', SDest, Event )
00033		{
00034			SmokeDestObj = SDest;
00035			break;
00036		}
00037		if ( SmokeDestObj == None )
00038		{
00039			Destroy();
00040			return;
00041		}
00042		NumPuffsSpawned = 0;
00043		if( bInitiallyActive )
00044		{
00045			Enable('Timer');
00046			SetTimer( SmokeDelay+FRand()*SmokeDelayVariance, False );
00047		}
00048		else
00049			Enable('Trigger');
00050	}
00051	
00052	function Timer()
00053	{
00054		// Spawn another smoke puff sprite
00055		local RisingSpriteSmokePuff sp;
00056		
00057		sp = Spawn(class'RisingSpriteSmokePuff');
00058		sp.DrawScale = BasePuffSize+FRand()*SizeVariance;
00059		sp.Velocity  = (SmokeSpeed + FRand()*SpeedVariance) * 
00060						Normal(SmokeDestObj.Location - Location);
00061		sp.Acceleration = SmokeAccel;
00062		NumPuffsSpawned++;
00063		if( NumPuffsSpawned>TotalNumPuffs ) Destroy();
00064		SetTimer( SmokeDelay+FRand()*SmokeDelayVariance, False );
00065	}
00066	
00067	function Trigger( actor Other, pawn EventInstigator )
00068	{
00069		// Actor entered the triggers radius
00070		Enable('Timer');
00071		SetTimer( SmokeDelay+FRand()*SmokeDelayVariance, False );
00072	}
00073	
00074	function UnTrigger( actor Other, pawn EventInstigator )
00075	{
00076		// Actor left the triggers radius
00077		Disable('Timer');
00078	}
00079	
00080	defaultproperties
00081	{
00082	     bInitiallyActive=True
00083	     SmokeSpeed=100.000000
00084	     SmokeAccel=(Z=90.000000)
00085	     SmokeDelay=0.100000
00086	     SmokeDelayVariance=0.150000
00087	     SpeedVariance=20.000000
00088	     BasePuffSize=1.000000
00089	     SizeVariance=0.200000
00090	     TotalNumPuffs=10000
00091	     bHidden=True
00092	     bNetTemporary=False
00093	     DrawType=DT_Sprite
00094	}

End Source Code