UnrealShare
Class SlithProjectile

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

class SlithProjectile
extends Engine.Projectile

//============================================================================= // SlithProjectile. //=============================================================================
Variables
 float DotProduct
 rotator RandRot
 vector SurfaceNormal
 bool bInAir
 int i

States
OnSurface, Flying

Function Summary
 void Explode(vector HitLocation, vector HitNormal)
 void Timer()


State OnSurface Function Summary
 void ProcessTouch(Actor Other, vector HitLocation)


State Flying Function Summary
 void BeginState()
 void HitWall(vector HitNormal, Actor Wall)
 void TakeDamage(int NDamage, Pawn instigatedBy, Vector hitlocation, vector momentum, name damageType)
 void ProcessTouch(Actor Other, vector HitLocation)



Source Code


00001	//=============================================================================
00002	// SlithProjectile.
00003	//=============================================================================
00004	class SlithProjectile extends Projectile;
00005	
00006	#exec MESH IMPORT MESH=ngel ANIVFILE=MODELS\ngel_a.3D DATAFILE=MODELS\ngel_d.3D X=0 Y=0 Z=0 ZEROTEX=1
00007	#exec MESH ORIGIN MESH=ngel X=-20 Y=0 Z=0 YAW=0 PITCH=-64 ROLL=0
00008	
00009	#exec MESH SEQUENCE MESH=ngel SEQ=All     STARTFRAME=0   NUMFRAMES=56
00010	#exec MESH SEQUENCE MESH=ngel SEQ=Flying  STARTFRAME=0   NUMFRAMES=13
00011	#exec MESH SEQUENCE MESH=ngel SEQ=Still   STARTFRAME=13  NUMFRAMES=1
00012	#exec MESH SEQUENCE MESH=ngel SEQ=Hit     STARTFRAME=14  NUMFRAMES=10
00013	#exec MESH SEQUENCE MESH=ngel SEQ=Drip    STARTFRAME=24  NUMFRAMES=13
00014	#exec MESH SEQUENCE MESH=ngel SEQ=Slide   STARTFRAME=37  NUMFRAMES=7
00015	#exec MESH SEQUENCE MESH=ngel SEQ=Shrivel STARTFRAME=44  NUMFRAMES=12
00016	
00017	#exec TEXTURE IMPORT NAME=Jflare FILE=MODELS\flare.PCX
00018	#exec MESHMAP SCALE MESHMAP=ngel X=0.1 Y=0.1 Z=0.2
00019	#exec MESHMAP SETTEXTURE MESHMAP=ngel NUM=0 TEXTURE=Jflare
00020	
00021	#exec AUDIO IMPORT FILE="Sounds\slith\Slispt1.WAV" NAME="SliSpawn" GROUP="Slith"
00022	#exec AUDIO IMPORT FILE="Sounds\slith\SliImp2.WAV" NAME="SliImpact" GROUP="Slith"
00023	
00024	var rotator RandRot;
00025	var vector SurfaceNormal;	
00026	var bool bInAir;
00027	var float DotProduct;
00028	var int i;
00029	
00030	function Timer()
00031	{
00032		local GreenSmokePuff gsp;
00033	
00034		gsp = Spawn(class'GreenSmokePuff',,,Location+SurfaceNormal*9);
00035		if (i!=-1) 
00036		{
00037			if (LightBrightness > 10) LightBrightness -= 10;
00038			DrawScale = 0.9*DrawScale;
00039			gsp.DrawScale = DrawScale*5;
00040			i++;
00041			if (i>12) Explode(Location, vect(0,0,0));
00042		}
00043	}
00044	
00045	function Explode(vector HitLocation, vector HitNormal)
00046	{
00047		local FlameBall f;
00048	
00049	  	HurtRadius(damage * DrawScale, DrawScale * 200, 'corroded', MomentumTransfer, HitLocation);
00050		Destroy();	
00051	}
00052		
00053	auto state Flying
00054	{
00055		function ProcessTouch (Actor Other, vector HitLocation) 
00056		{ 
00057			if ( Slith(Other) == None )
00058				Explode(HitLocation, vect(0,0,0)); 
00059		}
00060	
00061		singular function TakeDamage( int NDamage, Pawn instigatedBy, Vector hitlocation, 
00062								vector momentum, name damageType )
00063		{
00064			Explode(Location, vect(0,0,0));
00065		}
00066	
00067		function HitWall( vector HitNormal, actor Wall )
00068		{
00069			MakeNoise(0.6);	
00070			bInAir = False;
00071			PlaySound(ImpactSound);	
00072			SurfaceNormal = HitNormal;
00073			RandRot = rotator(HitNormal);
00074			RandRot.Roll += 32768;
00075			SetRotation(RandRot);	
00076			PlaySound(ImpactSound);		
00077			SetPhysics(PHYS_None);
00078			GoToState('OnSurface');
00079		}
00080	
00081		function BeginState()
00082		{	
00083			i=-1;
00084			if (FRand() < 0.5)
00085				DrawScale = 0.3 + 0.7 * FRand();
00086			Velocity = Vector(Rotation) * speed;	
00087			SetTimer(0.2,True);
00088			RotationRate.Yaw = Int(200000 * FRand()) - 100000;
00089			RotationRate.Pitch = Int(FRand() * (200000 - Abs(RotationRate.Yaw))) 
00090									- (100000 - Abs(RotationRate.Yaw)/2);
00091			LoopAnim('Flying',0.4);
00092			SurfaceNormal = Vect(0,0,0);
00093			bInAir=True;
00094			PlaySound(SpawnSound);
00095			if( Region.zone.bWaterZone )
00096				Velocity=Velocity*0.7;
00097		}
00098	}
00099	
00100	state OnSurface
00101	{
00102		function ProcessTouch (Actor Other, vector HitLocation)
00103		{
00104			Explode(HitLocation, vect(0,0,0));
00105		}
00106	Begin:
00107		i=0;
00108		PlayAnim('Hit');
00109		FinishAnim();
00110		DotProduct = SurfaceNormal dot vect(0,0,-1);
00111		If( DotProduct > 0.7 )
00112		{
00113			PlayAnim('Drip',0.1);
00114			FinishAnim();
00115		}
00116		else if (DotProduct > -0.5)
00117		{
00118			PlayAnim('Slide',0.2);
00119			Finishanim();
00120		}
00121	}
00122	
00123	defaultproperties
00124	{
00125	     speed=750.000000
00126	     Damage=40.000000
00127	     MomentumTransfer=20000
00128	     SpawnSound=Sound'UnrealShare.Slith.SliSpawn'
00129	     ImpactSound=Sound'UnrealShare.Slith.SliImpact'
00130	     bNetTemporary=False
00131	     Mesh=LodMesh'UnrealShare.ngel'
00132	     DrawScale=0.500000
00133	     bUnlit=True
00134	     CollisionRadius=6.000000
00135	     CollisionHeight=4.000000
00136	     LightType=LT_Steady
00137	     LightEffect=LE_NonIncidence
00138	     LightBrightness=101
00139	     LightHue=88
00140	     LightSaturation=9
00141	     LightRadius=4
00142	     bBounce=True
00143	     bFixedRotationDir=True
00144	}

End Source Code