Botpack
Class TFemaleBody

source: e:\games\UnrealTournament\Botpack\Classes\TFemaleBody.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Decoration
         |
         +--Engine.Carcass
            |
            +--Botpack.UTHumanCarcass
               |
               +--Botpack.TFemaleBody
Direct Known Subclasses:TFemale1Carcass, TFemale2Carcass

class TFemaleBody
extends Botpack.UTHumanCarcass

//============================================================================= // TFemaleBody. //=============================================================================
Variables
 name Jerks[4]
 float LastHit
 bool bJerking


Function Summary
 void AnimEnd()
 void SpawnHead()
 void TakeDamage(int Damage, Pawn InstigatedBy, Vector Hitlocation, Vector Momentum, name DamageType)



Source Code


00001	//=============================================================================
00002	// TFemaleBody.
00003	//=============================================================================
00004	class TFemaleBody extends UTHumanCarcass
00005		abstract;
00006	
00007	var float LastHit;
00008	var bool bJerking;
00009	var name Jerks[4];
00010	
00011	replication
00012	{
00013		// Things the server should send to the client.
00014		unreliable if( Role==ROLE_Authority )
00015			LastHit, bJerking;
00016	}
00017	
00018	function SpawnHead()
00019	{
00020		local carcass carc;
00021	
00022		carc = Spawn(class'UT_HeadFemale');
00023		if ( carc != None )
00024		{
00025			carc.RemoteRole = ROLE_SimulatedProxy;
00026			carc.Initfor(self);
00027		}
00028	}
00029	function TakeDamage( int Damage, Pawn InstigatedBy, Vector Hitlocation, 
00030							Vector Momentum, name DamageType)
00031	{	
00032		local bool bRiddled;
00033	
00034		if ( bJerking || (AnimSequence == 'Dead9') )
00035		{
00036			bJerking = true;
00037			if ( Damage < 23 )
00038				LastHit = Level.TimeSeconds;
00039			else 
00040				bJerking = false;
00041		}
00042		Super.TakeDamage(Damage, InstigatedBy, HitLocation, Momentum, DamageType);
00043	
00044		if ( bJerking )
00045		{
00046			CumulativeDamage = 50;
00047			Velocity.Z = FMax(Velocity.Z, 40);
00048			if ( InstigatedBy == None )
00049			{
00050				bJerking = false;
00051				PlayAnim('Dead9B', 1.1, 0.1);
00052			}
00053		}
00054		if ( bJerking && (VSize(InstigatedBy.Location - Location) < 150)
00055			&& (InstigatedBy.Acceleration != vect(0,0,0))
00056			&& ((Normal(InstigatedBy.Velocity) Dot Normal(Location - InstigatedBy.Location)) > 0.7) )
00057		{
00058			bJerking = false;
00059			PlayAnim('Dead9B', 1.1, 0.1);
00060		}
00061	}
00062	
00063	function AnimEnd()
00064	{
00065		local name NewAnim;
00066	
00067		if ( AnimSequence == 'Dead9' )
00068			bJerking = true;
00069	
00070		if ( !bJerking )
00071			Super.AnimEnd();
00072		else if ( (Level.TimeSeconds - LastHit < 0.2) && (FRand() > 0.02) )
00073		{
00074			NewAnim = Jerks[Rand(4)];
00075			if ( NewAnim == AnimSequence )
00076			{
00077				if ( NewAnim == Jerks[0] )
00078					NewAnim = Jerks[1];
00079				else
00080					NewAnim = Jerks[0];
00081			}
00082			TweenAnim(NewAnim, 0.15);
00083		}
00084		else
00085		{
00086			bJerking = false;
00087			PlayAnim('Dead9B', 1.0, 0.1);
00088		}
00089	}
00090	
00091	defaultproperties
00092	{
00093	     Jerks(0)=GutHit
00094	     Jerks(1)=HeadHit
00095	     Jerks(2)=LeftHit
00096	     Jerks(3)=RightHit
00097	     MasterReplacement=Class'Botpack.TFemaleMasterChunk'
00098	     LifeSpan=0.000000
00099	     AnimSequence=Dead1
00100	     AnimFrame=0.000000
00101	     bBlockActors=True
00102	     bBlockPlayers=True
00103	     Mass=100.000000
00104	}

End Source Code