UnrealShare
Class ExplodingWall

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

class ExplodingWall
extends Engine.Effects

//============================================================================= // ExplodingWall. //=============================================================================
Variables
 name ActivatedBy[5]
 sound BreakingSound
 float ExplosionDimensions
 float ExplosionSize
 float GlassParticleSize
 Texture GlassTexture
 int Health
 int NumGlassChunks
 int NumWallChunks
 int NumWoodChunks
 float WallParticleSize
 Texture WallTexture
 float WoodParticleSize
 Texture WoodTexture
 bool bTranslucentGlass
 bool bUnlitGlass

States
Exploding

Function Summary
 void PreBeginPlay()


State Exploding Function Summary
 void Explode(Pawn EventInstigator, vector Momentum)
 void TakeDamage(int NDamage, Pawn instigatedBy, Vector hitlocation, Vector momentum, name damageType)
 void Trigger(Actor Other, Pawn EventInstigator)



Source Code


00001	//=============================================================================
00002	// ExplodingWall.
00003	//=============================================================================
00004	class ExplodingWall extends Effects;
00005	
00006	#exec Texture Import File=models\exp001.pcx  Name=s_Exp Mips=Off Flags=2
00007	
00008	var() float ExplosionSize;
00009	var() float ExplosionDimensions;
00010	var() float WallParticleSize;
00011	var() float WoodParticleSize;
00012	var() float GlassParticleSize;
00013	var() int NumWallChunks;
00014	var() int NumWoodChunks;
00015	var() int NumGlassChunks;
00016	var() texture WallTexture;
00017	var() texture WoodTexture;
00018	var() texture GlassTexture;
00019	var() int Health;
00020	var() name ActivatedBy[5];
00021	var() sound BreakingSound;
00022	var() bool bTranslucentGlass;
00023	var() bool bUnlitGlass;
00024	
00025	function PreBeginPlay()
00026	{
00027		DrawType = DT_None;
00028		Super.PreBeginPlay();
00029	}
00030	
00031	Auto State Exploding
00032	{
00033		singular function Trigger( actor Other, pawn EventInstigator )
00034		{
00035			Explode(EventInstigator, Vector(Rotation));
00036		}
00037	
00038		singular function TakeDamage( int NDamage, Pawn instigatedBy, Vector hitlocation,
00039							Vector momentum, name damageType)
00040		{
00041			local int i;
00042			local bool bAbort;	
00043	
00044			if ( bOnlyTriggerable )
00045				return;
00046			
00047			if ( DamageType != 'All' )
00048			{
00049				bAbort = true;
00050				for ( i=0; i<5; i++ )	 
00051					if (DamageType==ActivatedBy[i]) bAbort=False;
00052				if ( bAbort )
00053					return;
00054			}
00055			Health -= NDamage;
00056			if ( Health <= 0 )
00057				Explode(instigatedBy, Momentum);
00058		}
00059	
00060		function Explode( pawn EventInstigator, vector Momentum)
00061		{
00062			local int i;
00063			local Fragment s;
00064			local actor A;
00065	
00066			if( Event != '' )
00067				foreach AllActors( class 'Actor', A, Event )
00068					A.Trigger( Instigator, Instigator );
00069	
00070			Instigator = EventInstigator;
00071			if ( Instigator != None )
00072				MakeNoise(1.0);
00073			
00074			PlaySound(BreakingSound, SLOT_None,2.0);
00075		
00076			for (i=0 ; i<NumWallChunks ; i++) 
00077			{
00078				s = Spawn( class 'WallFragments',,,Location+ExplosionDimensions*VRand());
00079				if ( s != None )
00080				{
00081					s.CalcVelocity(vect(0,0,0),ExplosionSize);
00082					s.DrawScale = WallParticleSize;
00083					s.Skin = WallTexture;
00084				}
00085			}
00086			for (i=0 ; i<NumWoodChunks ; i++) 
00087			{
00088				s = Spawn( class 'WoodFragments',,,Location+ExplosionDimensions*VRand());
00089				if ( s != None )
00090				{
00091					s.CalcVelocity(vect(0,0,0),ExplosionSize);
00092					s.DrawScale = WoodParticleSize;
00093					s.Skin = WoodTexture;
00094				}
00095			}
00096			for (i=0 ; i<NumGlassChunks ; i++) 
00097			{
00098				s = Spawn( class 'GlassFragments', Owner,,Location+ExplosionDimensions*VRand());
00099				if ( s != None )
00100				{
00101					s.CalcVelocity(Momentum, ExplosionSize);
00102					s.DrawScale = GlassParticleSize;
00103					s.Skin = GlassTexture;
00104					s.bUnlit = bUnlitGlass;
00105					if (bTranslucentGlass) s.Style = STY_Translucent;
00106				}
00107			}
00108			Destroy();
00109		}
00110	}
00111	
00112	defaultproperties
00113	{
00114	     ExplosionSize=200.000000
00115	     ExplosionDimensions=120.000000
00116	     WallParticleSize=1.000000
00117	     WoodParticleSize=1.000000
00118	     GlassParticleSize=1.000000
00119	     NumWallChunks=10
00120	     NumWoodChunks=3
00121	     ActivatedBy(0)=exploded
00122	     bNetTemporary=False
00123	     RemoteRole=ROLE_SimulatedProxy
00124	     DrawType=DT_Sprite
00125	     Texture=Texture'UnrealShare.s_Exp'
00126	     DrawScale=0.300000
00127	     CollisionRadius=32.000000
00128	     CollisionHeight=32.000000
00129	     bCollideActors=True
00130	     bCollideWorld=True
00131	     bProjTarget=True
00132	}

End Source Code