UnrealI
Class SkaarjPlayer

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

class SkaarjPlayer
extends UnrealShare.UnrealIPlayer

//============================================================================= // SkaarjPlayer. //=============================================================================

Function Summary
 void PlayCrawling()
 void PlayDodge(eDodgeDir DodgeMove)
     
//-----------------------------------------------------------------------------
// Animation functions
 void PlayDuck()
 void PlayDying(name DamageType, vector HitLoc)
 void PlayFeignDeath()
 void PlayFiring()
 void PlayGutHit(float tweentime)
     
//FIXME - add death first frames as alternate takehit anims!!!
 void PlayHeadHit(float tweentime)
 void PlayInAir()
 void PlayLanded(float impactVel)
 void PlayLeftHit(float tweentime)
 void PlayRightHit(float tweentime)
 void PlayRising()
 void PlayRunning()
 void PlaySwimming()
 void PlayTurning()
 void PlayWaiting()
 void PlayWalking()
 void PlayWeaponSwitch(Weapon NewWeapon)
 
simulated
RunStep()
 void SwimAnimUpdate(bool bNotForward)
 void TweenToRunning(float tweentime)
 void TweenToSwimming(float tweentime)
 void TweenToWaiting(float tweentime)
 void TweenToWalking(float tweentime)
 
simulated
WalkStep()



Source Code


00001	//=============================================================================
00002	// SkaarjPlayer.
00003	//=============================================================================
00004	class SkaarjPlayer extends UnrealIPlayer;
00005	
00006	#exec AUDIO IMPORT FILE="..\UnrealShare\Sounds\Male\UWinjur41.WAV" NAME="MUWHit1" GROUP="Male"
00007	#exec AUDIO IMPORT FILE="..\UnrealShare\Sounds\Male\UWinjur42.WAV" NAME="MUWHit2" GROUP="Male"
00008	#exec AUDIO IMPORT FILE="Sounds\SkaarjPlayer\gasp01.WAV" NAME="SKPGasp1" GROUP="Skaarj"
00009	#exec AUDIO IMPORT FILE="Sounds\SkaarjPlayer\drown01.WAV" NAME="SKPDrown1" GROUP="Skaarj"
00010	#exec AUDIO IMPORT FILE="Sounds\SkaarjPlayer\jump01.WAV" NAME="SKPJump1" GROUP="Skaarj"
00011	#exec AUDIO IMPORT FILE="..\UnrealShare\Sounds\Cow\walknc.WAV" NAME="walkC" GROUP="Cow"
00012	#exec AUDIO IMPORT FILE="Sounds\SkaarjPlayer\injur01.WAV" NAME="SKPInjur1" GROUP="Skaarj"
00013	#exec AUDIO IMPORT FILE="Sounds\SkaarjPlayer\injur02.WAV" NAME="SKPInjur2" GROUP="Skaarj"
00014	#exec AUDIO IMPORT FILE="Sounds\SkaarjPlayer\injur03.WAV" NAME="SKPInjur3" GROUP="Skaarj"
00015	#exec AUDIO IMPORT FILE="Sounds\SkaarjPlayer\injur04.WAV" NAME="SKPInjur4" GROUP="Skaarj"
00016	#exec AUDIO IMPORT FILE="Sounds\SkaarjPlayer\death01.WAV" NAME="SKPDeath1" GROUP="Skaarj"
00017	#exec AUDIO IMPORT FILE="Sounds\SkaarjPlayer\death02.WAV" NAME="SKPDeath2" GROUP="Skaarj"
00018	#exec AUDIO IMPORT FILE="Sounds\SkaarjPlayer\death03.WAV" NAME="SKPDeath3" GROUP="Skaarj"
00019	#exec AUDIO IMPORT FILE="Sounds\SkaarjPlayer\land01.WAV" NAME="Land1SK" GROUP="Skaarj"
00020	
00021	simulated function WalkStep()
00022	{
00023		local sound step;
00024		local float decision;
00025		
00026		if ( Role < ROLE_Authority )
00027			return;
00028		if ( FootRegion.Zone.bWaterZone )
00029		{
00030			PlaySound(sound 'LSplash', SLOT_Interact, 1, false, 1000.0, 1.0);
00031			return;
00032		}
00033	
00034		PlaySound(Footstep1, SLOT_Interact, 0.1, false, 800.0, 1.0);
00035	}
00036	
00037	simulated function RunStep()
00038	{
00039		local sound step;
00040		local float decision;
00041	
00042		if ( Role < ROLE_Authority )
00043			return;
00044		if ( FootRegion.Zone.bWaterZone )
00045		{
00046			PlaySound(sound 'LSplash', SLOT_Interact, 1, false, 1000.0, 1.0);
00047			return;
00048		}
00049	
00050		PlaySound(Footstep1, SLOT_Interact, 0.7, false, 800.0, 1.0);
00051	}
00052	
00053	//-----------------------------------------------------------------------------
00054	// Animation functions
00055	
00056	function PlayDodge(eDodgeDir DodgeMove)
00057	{
00058		Velocity.Z = 210;
00059		if ( DodgeMove == DODGE_Left )
00060			PlayAnim('LeftDodge', 1.35, 0.06);
00061		else if ( DodgeMove == DODGE_Right )
00062			PlayAnim('RightDodge', 1.35, 0.06);
00063		else if ( DodgeMove == DODGE_Forward )
00064			PlayAnim('Lunge', 1.2, 0.06);
00065		else
00066			PlayDuck();
00067	}
00068			
00069	function PlayTurning()
00070	{
00071		BaseEyeHeight = Default.BaseEyeHeight;
00072		PlayAnim('Turn', 0.3, 0.3);
00073	}
00074	
00075	function TweenToWalking(float tweentime)
00076	{
00077		BaseEyeHeight = Default.BaseEyeHeight;
00078		if (Weapon == None)
00079			TweenAnim('Walk', tweentime);
00080		else if ( Weapon.bPointing || (CarriedDecoration != None) ) 
00081			TweenAnim('WalkFire', tweentime);
00082		else
00083			TweenAnim('Walk', tweentime);
00084	}
00085	
00086	function TweenToRunning(float tweentime)
00087	{
00088		BaseEyeHeight = Default.BaseEyeHeight;
00089		if (bIsWalking)
00090			TweenToWalking(0.1);
00091		else if (Weapon == None)
00092			PlayAnim('Jog', 1, tweentime);
00093		else if ( Weapon.bPointing ) 
00094			PlayAnim('JogFire', 1, tweentime);
00095		else
00096			PlayAnim('Jog', 1, tweentime);
00097	}
00098	
00099	function PlayWalking()
00100	{
00101		BaseEyeHeight = Default.BaseEyeHeight;
00102		if (Weapon == None)
00103			LoopAnim('Walk',1.1);
00104		else if ( Weapon.bPointing || (CarriedDecoration != None) ) 
00105			LoopAnim('WalkFire',1.1);
00106		else
00107			LoopAnim('Walk',1.1);
00108	}
00109	
00110	function PlayRunning()
00111	{
00112		BaseEyeHeight = Default.BaseEyeHeight;
00113		if (Weapon == None)
00114			LoopAnim('Jog',1.1);
00115		else if ( Weapon.bPointing ) 
00116			LoopAnim('JogFire',1.1);
00117		else
00118			LoopAnim('Jog',1.1);
00119	}
00120	
00121	function PlayRising()
00122	{
00123		BaseEyeHeight = 0.4 * Default.BaseEyeHeight;
00124		PlayAnim('Getup', 0.7, 0.1);
00125	}
00126	
00127	function PlayFeignDeath()
00128	{
00129		BaseEyeHeight = 0;
00130		PlayAnim('Death2',0.7);
00131	}
00132	
00133	function PlayDying(name DamageType, vector HitLoc)
00134	{
00135		local vector X,Y,Z, HitVec, HitVec2D;
00136		local float dotp;
00137	
00138		BaseEyeHeight = Default.BaseEyeHeight;
00139		PlayDyingSound();
00140				
00141		if ( FRand() < 0.15 )
00142		{
00143			PlayAnim('Death',0.7,0.1);
00144			return;
00145		}
00146	
00147		// check for big hit
00148		if ( (Velocity.Z > 250) && (FRand() < 0.7) )
00149		{
00150			PlayAnim('Death2', 0.7, 0.1);
00151			return;
00152		}
00153	
00154		// check for head hit
00155		if ( (DamageType == 'Decapitated') || (HitLoc.Z - Location.Z > 0.6 * CollisionHeight) )
00156		{
00157			DamageType = 'Decapitated';
00158			PlayAnim('Death', 0.7, 0.1);
00159			return;
00160		}
00161	
00162		
00163		if ( FRand() < 0.15)
00164		{
00165			PlayAnim('Death3', 0.7, 0.1);
00166			return;
00167		}
00168	
00169		GetAxes(Rotation,X,Y,Z);
00170		X.Z = 0;
00171		HitVec = Normal(HitLoc - Location);
00172		HitVec2D= HitVec;
00173		HitVec2D.Z = 0;
00174		dotp = HitVec2D dot X;
00175		
00176		if (Abs(dotp) > 0.71) //then hit in front or back
00177			PlayAnim('Death3', 0.7, 0.1);
00178		else
00179		{
00180			dotp = HitVec dot Y;
00181			if (dotp > 0.0)
00182				PlayAnim('Death', 0.7, 0.1);
00183			else
00184				PlayAnim('Death4', 0.7, 0.1);
00185		}
00186	}
00187	
00188	//FIXME - add death first frames as alternate takehit anims!!!
00189	
00190	function PlayGutHit(float tweentime)
00191	{
00192		if ( AnimSequence == 'GutHit' )
00193		{
00194			if (FRand() < 0.5)
00195				TweenAnim('LeftHit', tweentime);
00196			else
00197				TweenAnim('RightHit', tweentime);
00198		}
00199		else
00200			TweenAnim('GutHit', tweentime);
00201	}
00202	
00203	function PlayHeadHit(float tweentime)
00204	{
00205		if ( AnimSequence == 'HeadHit' )
00206			TweenAnim('GutHit', tweentime);
00207		else
00208			TweenAnim('HeadHit', tweentime);
00209	}
00210	
00211	function PlayLeftHit(float tweentime)
00212	{
00213		if ( AnimSequence == 'LeftHit' )
00214			TweenAnim('GutHit', tweentime);
00215		else
00216			TweenAnim('LeftHit', tweentime);
00217	}
00218	
00219	function PlayRightHit(float tweentime)
00220	{
00221		if ( AnimSequence == 'RightHit' )
00222			TweenAnim('GutHit', tweentime);
00223		else
00224			TweenAnim('RightHit', tweentime);
00225	}
00226		
00227	function PlayLanded(float impactVel)
00228		{	
00229			impactVel = impactVel/JumpZ;
00230			impactVel = 0.1 * impactVel * impactVel;
00231			BaseEyeHeight = Default.BaseEyeHeight;
00232	
00233			if ( Role == ROLE_Authority )
00234			{
00235				if ( impactVel > 0.17 )
00236					PlaySound(LandGrunt, SLOT_Talk, FMin(5, 5 * impactVel),false,1200,FRand()*0.4+0.8);
00237				if ( !FootRegion.Zone.bWaterZone && (impactVel > 0.01) )
00238					PlaySound(Land, SLOT_Interact, FClamp(4.5 * impactVel,0.5,6), false, 1000, 1.0);
00239			}
00240	
00241			if ( (GetAnimGroup(AnimSequence) == 'Dodge') && IsAnimating() )
00242				return;
00243			if ( (impactVel > 0.06) || (GetAnimGroup(AnimSequence) == 'Jumping') )
00244				TweenAnim('Land', 0.12);
00245			else if ( !IsAnimating() )
00246			{
00247				if ( GetAnimGroup(AnimSequence) == 'TakeHit' )
00248					AnimEnd();
00249				else
00250					TweenAnim('Land', 0.12);
00251			}
00252		}
00253		
00254	function PlayInAir()
00255	{
00256		BaseEyeHeight =  Default.BaseEyeHeight;
00257		TweenAnim('InAir', 0.4);
00258	}
00259	
00260	function PlayDuck()
00261	{
00262		BaseEyeHeight = 0;
00263		TweenAnim('Duck', 0.25);
00264	}
00265	
00266	function PlayCrawling()
00267	{
00268		BaseEyeHeight = 0;
00269		LoopAnim('DuckWalk');
00270	}
00271	
00272	function TweenToWaiting(float tweentime)
00273	{
00274		if( IsInState('PlayerSwimming') || Physics==PHYS_Swimming )
00275		{
00276			BaseEyeHeight = 0.7 * Default.BaseEyeHeight;
00277			TweenAnim('Swim', tweentime);
00278		}
00279		else
00280		{
00281			BaseEyeHeight = Default.BaseEyeHeight;
00282			TweenAnim('Firing', tweentime);
00283		}
00284	}
00285		
00286	function PlayWaiting()
00287	{
00288		local name newAnim;
00289	
00290		if( IsInState('PlayerSwimming') || (Physics==PHYS_Swimming) )
00291		{
00292			BaseEyeHeight = 0.7 * Default.BaseEyeHeight;
00293			LoopAnim('Swim');
00294		}
00295		else
00296		{	
00297			BaseEyeHeight = Default.BaseEyeHeight;
00298			if ( (Weapon != None) && Weapon.bPointing )
00299				TweenAnim('Firing', 0.3);
00300			else
00301			{
00302				if ( FRand() < 0.2 )
00303					newAnim = 'Breath';
00304				else
00305					newAnim = 'Breath2';
00306				
00307				if ( AnimSequence == newAnim )
00308					LoopAnim(newAnim, 0.3 + 0.7 * FRand());
00309				else
00310					PlayAnim(newAnim, 0.3 + 0.7 * FRand(), 0.25);
00311			}
00312		}
00313	}	
00314	
00315	function PlayFiring()
00316	{
00317		// switch animation sequence mid-stream if needed
00318		if (AnimSequence == 'Jog')
00319			AnimSequence = 'JogFire';
00320		else if (AnimSequence == 'Walk')
00321			AnimSequence = 'WalkFire';
00322		else if ( AnimSequence == 'InAir' )
00323			TweenAnim('JogFire', 0.03);
00324		else if ( (GetAnimGroup(AnimSequence) != 'Attack')
00325				&& (GetAnimGroup(AnimSequence) != 'MovingAttack') 
00326				&& (GetAnimGroup(AnimSequence) != 'Dodge')
00327				&& (AnimSequence != 'Swim') )
00328			TweenAnim('Firing', 0.02);
00329	}
00330	
00331	function PlayWeaponSwitch(Weapon NewWeapon)
00332	{
00333	}
00334	
00335	function PlaySwimming()
00336	{
00337		BaseEyeHeight = 0.7 * Default.BaseEyeHeight;
00338		LoopAnim('Swim');
00339	}
00340	
00341	function TweenToSwimming(float tweentime)
00342	{
00343		BaseEyeHeight = 0.7 * Default.BaseEyeHeight;
00344		TweenAnim('Swim',tweentime);
00345	}
00346	
00347	function SwimAnimUpdate(bool bNotForward)
00348	{
00349		if ( !bAnimTransition && (GetAnimGroup(AnimSequence) != 'Gesture') && (AnimSequence != 'Swim') )
00350			TweenToSwimming(0.1);
00351	}
00352	
00353	defaultproperties
00354	{
00355	     drown=Sound'UnrealI.Skaarj.SKPDrown1'
00356	     breathagain=Sound'UnrealI.Skaarj.SKPGasp1'
00357	     Footstep1=Sound'UnrealShare.Cow.walkC'
00358	     Footstep2=Sound'UnrealShare.Cow.walkC'
00359	     Footstep3=Sound'UnrealShare.Cow.walkC'
00360	     HitSound3=Sound'UnrealI.Skaarj.SKPInjur3'
00361	     HitSound4=Sound'UnrealI.Skaarj.SKPInjur4'
00362	     Die2=Sound'UnrealI.Skaarj.SKPDeath2'
00363	     Die3=Sound'UnrealI.Skaarj.SKPDeath3'
00364	     Die4=Sound'UnrealI.Skaarj.SKPDeath3'
00365	     GaspSound=Sound'UnrealI.Skaarj.SKPGasp1'
00366	     UWHit1=Sound'UnrealShare.Male.MUWHit1'
00367	     UWHit2=Sound'UnrealShare.Male.MUWHit2'
00368	     LandGrunt=Sound'UnrealI.Skaarj.Land1SK'
00369	     CarcassType=Class'UnrealI.TrooperCarcass'
00370	     JumpSound=Sound'UnrealI.Skaarj.SKPJump1'
00371	     bSinglePlayer=False
00372	     JumpZ=360.000000
00373	     BaseEyeHeight=24.750000
00374	     EyeHeight=24.750000
00375	     Health=130
00376	     HitSound1=Sound'UnrealI.Skaarj.SKPInjur1'
00377	     HitSound2=Sound'UnrealI.Skaarj.SKPInjur2'
00378	     Die=Sound'UnrealI.Skaarj.SKPDeath1'
00379	     MenuName="Skaarj"
00380	     Skin=Texture'UnrealI.Skins.sktrooper1'
00381	     Mesh=LodMesh'UnrealI.sktrooper'
00382	     CollisionRadius=32.000000
00383	     CollisionHeight=42.000000
00384	     Mass=120.000000
00385	     Buoyancy=118.800003
00386	}

End Source Code