UnrealI
Class ParentBlob

source: e:\games\UnrealTournament\UnrealI\Classes\ParentBlob.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Pawn
         |
         +--UnrealShare.FlockMasterPawn
            |
            +--UnrealI.ParentBlob
Direct Known Subclasses:None

class ParentBlob
extends UnrealShare.FlockMasterPawn

//============================================================================= // ParentBlob. //=============================================================================
Variables
 string BlobKillMessage
 bool bEnemyVisible
 int numBlobs

States
Attacking, stasis

Function Summary
 void BaseChange()
 string KillMessage(name damageType, Pawn Other)
 void Killed(Pawn Killer, Pawn Other, name damageType)
 void PreSetMovement()
 void SetRadius()
 void Shrink(Bloblet b)
 void setMovementPhysics()


State Attacking Function Summary
 void EnemyNotVisible()
 void SeePlayer(Actor SeenPlayer)
 void Tick(float DeltaTime)
 void Timer()


State stasis Function Summary
 void SeePlayer(Actor SeenPlayer)



Source Code


00001	//=============================================================================
00002	// ParentBlob.
00003	//=============================================================================
00004	class ParentBlob extends FlockMasterPawn;
00005	
00006	var bool bEnemyVisible;
00007	var int numBlobs;
00008	var	bloblet blobs[16]; 
00009	var localized string BlobKillMessage;
00010	
00011	function setMovementPhysics()
00012	{
00013		SetPhysics(PHYS_Spider);
00014	}
00015	
00016	function string KillMessage(name damageType, pawn Other)
00017	{
00018		return(BlobKillMessage);
00019	}
00020	
00021	function Shrink(bloblet b)
00022	{
00023		local int i,j;
00024		
00025		for (i=0; i<numBlobs; i++ )
00026			if ( blobs[i] == b )
00027				break;
00028		numBlobs--;
00029		for (j=i;j<numBlobs; j++ )
00030			blobs[j] = blobs[j+1];
00031		if (numBlobs == 0)
00032			Destroy();
00033		else
00034			SetRadius();
00035	}
00036	
00037	function SetRadius()
00038	{
00039		local int i;
00040		local float size;
00041		
00042		size = 24 + 1.5 * numBlobs;
00043		for (i=0; i<numBlobs; i++)
00044			blobs[i].Orientation = size * vector(rot(0,65536,0) * i/numBlobs);
00045	}
00046		
00047	function PreSetMovement()
00048	{
00049		bCanWalk = true;
00050		bCanSwim = true;
00051		bCanFly = false;
00052		MinHitWall = -0.6;
00053	}
00054	
00055	
00056	function BaseChange()
00057	{
00058	}
00059	
00060	function Killed(pawn Killer, pawn Other, name damageType)
00061	{
00062		local int i;
00063	
00064		if (Other == Enemy)
00065		{
00066			for (i=0; i<numBlobs; i++ )
00067				blobs[i].GotoState('Sleep');
00068			GotoState('stasis');
00069		}
00070	}
00071	
00072	auto state stasis
00073	{
00074	ignores EncroachedBy, EnemyNotVisible;
00075		
00076		function SeePlayer(Actor SeenPlayer)
00077		{
00078			local bloblet b;
00079			local pawn aPawn;
00080			local int i;
00081	
00082			if ( numBlobs == 0)
00083			{
00084				aPawn = Level.PawnList;
00085				while ( aPawn != None )
00086				{
00087					b = bloblet(aPawn);
00088					if ( (b != None) && (b.tag == tag) )
00089					{
00090						blobs[numBlobs] = b;
00091						numBlobs++;
00092						b.parentBlob = self;
00093						b.GotoState('Active');
00094					}
00095					if (numBlobs < 15)
00096						aPawn = aPawn.nextPawn;
00097					else
00098						aPawn = None;
00099				}
00100				SetRadius();
00101			}
00102			enemy = Pawn(SeenPlayer);
00103			bEnemyVisible = true;
00104			Gotostate('Attacking');
00105		}
00106	
00107	Begin:
00108		SetPhysics(PHYS_None);
00109	}
00110	
00111	state Attacking
00112	{
00113		function Timer()
00114		{
00115			local int i;
00116	
00117			Enemy = None;
00118			for (i=0; i<numBlobs; i++ )
00119				blobs[i].GotoState('asleep');
00120			GotoState('Stasis');
00121		}
00122	
00123		function Tick(float DeltaTime)
00124		{
00125			local int i;
00126			
00127			for (i=0; i<numBlobs; i++ )
00128				if ( blobs[i].MoveTarget == None )
00129					blobs[i].Destination = Location + blobs[i].Orientation;
00130		}
00131		
00132		function SeePlayer(Actor SeenPlayer)
00133		{
00134			Disable('SeePlayer');
00135			Enable('EnemyNotVisible');
00136			bEnemyVisible = true;
00137			SetTimer(0, false);
00138		}
00139		
00140		function EnemyNotVisible()
00141		{
00142			Disable('EnemyNotVisible');
00143			Enable('SeePlayer');
00144			bEnemyVisible = false;
00145			SetTimer(35, false);
00146		}
00147			
00148	Begin:
00149		SetPhysics(PHYS_Spider);
00150		
00151	Chase:
00152		if (bEnemyVisible)
00153			MoveToward(Enemy);
00154		else
00155			MoveTo(LastSeenPos);
00156	
00157		Sleep(0.1);
00158		Goto('Chase');
00159	}
00160	
00161	defaultproperties
00162	{
00163	     BlobKillMessage="was corroded by a Blob"
00164	     GroundSpeed=150.000000
00165	     WaterSpeed=150.000000
00166	     AccelRate=800.000000
00167	     JumpZ=-1.000000
00168	     MaxStepHeight=50.000000
00169	     SightRadius=1000.000000
00170	     PeripheralVision=-5.000000
00171	     HearingThreshold=50.000000
00172	     Intelligence=BRAINS_NONE
00173	     bHidden=True
00174	     Tag=blob1
00175	}

End Source Code