Botpack
Class BioGlob

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

class BioGlob
extends Botpack.UT_BioGel

//============================================================================= // BioGlob //=============================================================================
Variables
 int NumSplash
 vector SpawnPoint

States
OnSurface, Flying
State OnSurface Function Summary
 void ProcessTouch(Actor Other, vector HitLocation)
 void Tick(float DeltaTime)


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



Source Code


00001	//=============================================================================
00002	// BioGlob
00003	//=============================================================================
00004	class BioGlob extends UT_BioGel;
00005	
00006	var int NumSplash;
00007	var vector SpawnPoint;
00008	
00009	auto state Flying
00010	{
00011		function ProcessTouch (Actor Other, vector HitLocation) 
00012		{ 
00013			if ( Other.IsA('BioSplash') )
00014				return;
00015			if ( Pawn(Other)!=Instigator || bOnGround) 
00016				Global.Timer(); 
00017		}
00018		simulated function HitWall( vector HitNormal, actor Wall )
00019		{
00020	
00021			SetPhysics(PHYS_None);		
00022			MakeNoise(1);	
00023			bOnGround = True;
00024			PlaySound(ImpactSound);	
00025			SetWall(HitNormal, Wall);
00026			if ( DrawScale > 1 )
00027				NumSplash = int(2 * DrawScale) - 1;
00028			SpawnPoint = Location + 5 * HitNormal;
00029			DrawScale= FMin(DrawScale, 3.0);
00030			if ( NumSplash > 0 )
00031			{
00032				SpawnSplash();
00033				if ( NumSplash > 0 )
00034					SpawnSplash();
00035			}
00036			GoToState('OnSurface');
00037		}
00038	}
00039	
00040	function SpawnSplash()
00041	{
00042		local vector Start;
00043	
00044		NumSplash--;
00045		Start = SpawnPoint + 4 * VRand(); 
00046		Spawn(class'BioSplash',,,Start,Rotator(Start - Location));
00047	}
00048	
00049	state OnSurface
00050	{
00051		function Tick(float DeltaTime)
00052		{
00053			if ( NumSplash > 0 )
00054			{
00055				SpawnSplash();
00056				if ( NumSplash > 0 )
00057					SpawnSplash();
00058				else
00059					Disable('Tick');
00060			}
00061			else
00062				Disable('Tick');
00063		}
00064	
00065		function ProcessTouch (Actor Other, vector HitLocation)
00066		{
00067			if ( Other.IsA('BioSplash') )
00068				return;
00069			GotoState('Exploding');
00070		}
00071	}
00072	
00073	defaultproperties
00074	{
00075	     speed=700.000000
00076	     Damage=75.000000
00077	     MomentumTransfer=30000
00078	}

End Source Code