UnrealI
Class LeglessKrall

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

class LeglessKrall
extends UnrealI.Krall

//============================================================================= // LeglessKrall. //=============================================================================
Variables
 float startTime

States
TacticalMove

Function Summary
 bool CanFireAtEnemy()
 void Initfor(Krall Other)
 void PlayChallenge()
 void PlayDying(name DamageType, vector HitLoc)
 void PlayInAir()
 void PlayLanded(float impactVel)
 void PlayMeleeAttack()
 void PlayMovingAttack()
 void PlayOutOfWater()
 void PlayPatrolStop()
 void PlayRangedAttack()
 void PlayRunning()
 void PlaySwimming()
 void PlayTakeHit(float tweentime, vector HitLoc, int damage)
 void PlayThreatening()
 void PlayTurning()
 void PlayVictoryDance()
 void PlayWaiting()
 void PlayWaitingAmbush()
 void PlayWalking()
 void PreBeginPlay()
 void SpawnShot()
 void TakeDamage(int Damage, Pawn instigatedBy, Vector hitlocation, Vector momentum, name damageType)
 void TweenToFalling()
 void TweenToFighter(float tweentime)
 void TweenToPatrolStop(float tweentime)
 void TweenToRunning(float tweentime)
 void TweenToSwimming(float tweentime)
 void TweenToWaiting(float tweentime)
 void TweenToWalking(float tweentime)
 void WhatToDoNext(name LikelyState, name LikelyLabel)


State TacticalMove Function Summary
 void TweenToRunning(float tweentime)



Source Code


00001	//=============================================================================
00002	// LeglessKrall.
00003	//=============================================================================
00004	class LeglessKrall extends Krall;
00005	
00006	var float startTime;
00007	
00008	function PreBeginPlay()
00009	{
00010		bCanSpeak = true;
00011		voicePitch = 0.25 + 0.5 * FRand();
00012		if ( CombatStyle == Default.CombatStyle)
00013			CombatStyle = CombatStyle + 0.4 * FRand() - 0.2;
00014		bCanDuck = (FRand() < 0.5);
00015		Super.PreBeginPlay();
00016		CombatStyle = 1.0;
00017		bCanDuck = false;
00018		bCanStrafe = false;
00019		startTime = Level.TimeSeconds;
00020	}
00021	
00022	function TakeDamage( int Damage, Pawn instigatedBy, Vector hitlocation, 
00023							Vector momentum, name damageType)
00024	{
00025		if ( Level.timeSeconds - startTime < 0.3 )
00026			return;
00027		Health = Min(-1, Health - Damage);
00028		PlayDeathHit(Damage, hitLocation, damageType, Momentum);
00029		Enemy = instigatedBy;
00030		Died(instigatedBy, damageType, HitLocation);
00031	}
00032	
00033	function WhatToDoNext(name LikelyState, name LikelyLabel)
00034	{
00035		Health = -1;
00036		Died(self, '', Location);
00037	}
00038	
00039	function PlayTakeHit(float tweentime, vector HitLoc, int damage)
00040	{
00041		TweenAnim('Drag', tweentime);
00042	}
00043	
00044	function PlayWaiting()
00045	{
00046		TweenAnim('Drag', 0.3);
00047	}
00048	
00049	function PlayPatrolStop()
00050	{
00051		TweenAnim('Drag', 0.3);
00052	}
00053	
00054	function PlayWaitingAmbush()
00055	{
00056		TweenAnim('Drag', 0.3);
00057	}
00058	
00059	function PlayChallenge()
00060	{
00061		TweenAnim('Shoot3', 0.3);
00062	}
00063	
00064	function TweenToFighter(float tweentime)
00065	{
00066		TweenAnim('Shoot3', tweentime);
00067	}
00068	
00069	function TweenToRunning(float tweentime)
00070	{
00071		TweenAnim('Drag', tweentime);
00072	}
00073	
00074	function TweenToWalking(float tweentime)
00075	{
00076		TweenAnim('Drag', tweentime);
00077	}
00078	
00079	function TweenToWaiting(float tweentime)
00080	{
00081		TweenAnim('Drag', tweentime);
00082	}
00083	
00084	function TweenToPatrolStop(float tweentime)
00085	{
00086		TweenAnim('Drag', tweentime);
00087	}
00088	
00089	function TweenToFalling()
00090	{
00091		TweenAnim('Shoot3', 0.3);
00092	}
00093	
00094	function PlayInAir()
00095	{
00096		TweenAnim('Shoot3', 0.3);
00097	}
00098	
00099	function PlayOutOfWater()
00100	{
00101		TweenAnim('Shoot3', 0.3);
00102	}
00103	
00104	function PlayLanded(float impactVel)
00105	{
00106		TweenAnim('LeglessDeath', 0.1);
00107	}
00108	
00109	function PlayMovingAttack()
00110	{
00111		LoopAnim('Shoot3');
00112	}
00113	
00114	function PlayRunning()
00115	{
00116		LoopAnim('Drag');
00117	}
00118	
00119	function PlayWalking()
00120	{
00121		LoopAnim('Drag');
00122	}
00123	
00124	function TweenToSwimming(float tweentime)
00125	{
00126		TweenAnim('Drag', tweentime);
00127	}
00128	
00129	function PlaySwimming()
00130	{
00131		LoopAnim('Drag');
00132	}
00133	
00134	function PlayThreatening()
00135	{
00136		TweenAnim('Shoot3', 0.3);
00137	}
00138	
00139	function PlayTurning()
00140	{
00141		PlayAnim('Drag');
00142	}
00143	
00144	function PlayDying(name DamageType, vector HitLoc)
00145	{
00146		PlaySound(Die, SLOT_Talk, 4 * TransientSoundVolume);
00147		TweenAnim('LeglessDeath', 0.4);
00148	}
00149	
00150	function PlayVictoryDance()
00151	{
00152		TweenAnim('Shoot3', 0.3);
00153	}
00154	
00155	function bool CanFireAtEnemy()
00156	{
00157		local vector HitLocation, HitNormal,X,Y,Z, projStart, EnemyDir, EnemyUp;
00158		local actor HitActor;
00159		local float EnemyDist;
00160			
00161		EnemyDir = Enemy.Location - Location;
00162		EnemyDist = VSize(EnemyDir);
00163		EnemyUp = Enemy.CollisionHeight * vect(0,0,0.9);
00164		if ( EnemyDist > 300 )
00165		{
00166			EnemyDir = 300 * EnemyDir/EnemyDist;
00167			EnemyUp = 300 * EnemyUp/EnemyDist;
00168		}
00169		
00170		GetAxes(Rotation,X,Y,Z);
00171		projStart = Location + 0.9 * CollisionRadius * X - 0.9 * CollisionRadius * Y;
00172		HitActor = Trace(HitLocation, HitNormal, projStart + EnemyDir + EnemyUp, projStart, true);
00173	
00174		if ( (HitActor == None) || (HitActor == Enemy) 
00175			|| ((Pawn(HitActor) != None) && (AttitudeTo(Pawn(HitActor)) <= ATTITUDE_Ignore)) )
00176			return true;
00177	
00178		HitActor = Trace(HitLocation, HitNormal, projStart + EnemyDir, projStart , true);
00179	
00180		return ( (HitActor == None) || (HitActor == Enemy) 
00181				|| ((Pawn(HitActor) != None) && (AttitudeTo(Pawn(HitActor)) <= ATTITUDE_Ignore)) );
00182	}
00183		
00184	function SpawnShot()
00185	{
00186		FireProjectile( vect(0.9, -0.9, 0), 500);
00187	}
00188	
00189	function PlayMeleeAttack()
00190	{
00191		PlayAnim('Shoot3');
00192	}
00193	
00194	function PlayRangedAttack()
00195	{
00196		PlayAnim('Shoot3');
00197	}
00198	
00199	function Initfor(Krall Other)
00200	{
00201		local rotator carcRotation;
00202	
00203		bMeshCurvy = Other.bMeshCurvy;	
00204		bMeshEnviroMap = Other.bMeshEnviroMap;	
00205		Mesh = Other.Mesh;
00206		Skin = Other.Skin;
00207		Texture = Other.Texture;
00208		Fatness = Other.Fatness;
00209		DrawScale = Other.DrawScale;
00210		Tag = Other.Tag;
00211		Event = '';
00212	
00213		PlayAnim('LegLoss', 0.7);
00214		SetPhysics(PHYS_Falling);
00215		Velocity = other.Velocity;
00216		Enemy=Other.Enemy;
00217		OldEnemy=Other.OldEnemy;
00218		NextState='Attacking';
00219		NextLabel='Begin';
00220		GotoState('TakeHit');
00221	}
00222	
00223	state TacticalMove
00224	{
00225	ignores SeePlayer, HearNoise;
00226	
00227		function TweenToRunning(float tweentime)
00228		{
00229			TweenAnim('Drag', tweentime);
00230		}
00231	}
00232	
00233	defaultproperties
00234	{
00235	     Aggressiveness=10.000000
00236	     bMovingRangedAttack=False
00237	     MeleeRange=-30.000000
00238	     GroundSpeed=80.000000
00239	     JumpZ=-1.000000
00240	     UnderWaterTime=1.000000
00241	     AnimSequence=LegLoss
00242	     PrePivot=(Z=25.000000)
00243	     CollisionHeight=21.000000
00244	}

End Source Code