UnrealShare
Class SCUBAGear

source: e:\games\UnrealTournament\UnrealShare\Classes\SCUBAGear.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Inventory
         |
         +--Engine.Pickup
            |
            +--UnrealShare.SCUBAGear
Direct Known Subclasses:None

class SCUBAGear
extends Engine.Pickup

//============================================================================= // SCUBAGear. //=============================================================================
Variables
 vector X,Y,Z

States
DeActivated, Activated

Function Summary
 Inventory PrioritizeArmor(int Damage, name DamageType, vector HitLocation)
 void UsedUp()


State DeActivated Function Summary


State Activated Function Summary
 void Timer()
 void endstate()



Source Code


00001	//=============================================================================
00002	// SCUBAGear.
00003	//=============================================================================
00004	class SCUBAGear extends Pickup;
00005	
00006	#exec AUDIO IMPORT FILE="Sounds\Pickups\scubada1.WAV" NAME="Scubada1" GROUP="Pickups"
00007	#exec AUDIO IMPORT FILE="Sounds\Pickups\scubal1.WAV" NAME="Scubal1" GROUP="Pickups"
00008	#exec AUDIO IMPORT FILE="Sounds\Pickups\scubal2.WAV" NAME="Scubal2" GROUP="Pickups"
00009	
00010	#exec TEXTURE IMPORT NAME=I_Scuba FILE=TEXTURES\HUD\i_scuba.PCX GROUP="Icons" MIPS=OFF
00011	
00012	#exec MESH IMPORT MESH=Scuba ANIVFILE=MODELS\Scuba_a.3D DATAFILE=MODELS\Scuba_d.3D X=0 Y=0 Z=0
00013	#exec MESH ORIGIN MESH=Scuba X=0 Y=-400 Z=-100 YAW=64
00014	#exec MESH SEQUENCE MESH=Scuba SEQ=All    STARTFRAME=0  NUMFRAMES=1
00015	#exec TEXTURE IMPORT NAME=ASC1 FILE=MODELS\scuba.PCX GROUP="Skins"
00016	#exec MESHMAP SCALE MESHMAP=Scuba X=0.04 Y=0.04 Z=0.08
00017	#exec MESHMAP SETTEXTURE MESHMAP=Scuba NUM=1 TEXTURE=ASC1
00018	
00019	var vector X,Y,Z;	
00020	
00021	function inventory PrioritizeArmor( int Damage, name DamageType, vector HitLocation )
00022	{
00023		if (DamageType == 'Breathe') 
00024		{
00025			if (Pawn(Owner)!=None && IsInState('activated')
00026				&& !Pawn(Owner).FootRegion.Zone.bPainZone) Pawn(Owner).PainTime=12;
00027			GotoState('Deactivated');
00028		}
00029		else if (DamageType == 'Drowned' && Damage==0) 
00030			GoToState('Activated');
00031		if (DamageType == 'Drowned')
00032		{
00033			NextArmor = None;
00034			Return Self;
00035		}
00036		return Super.PrioritizeArmor(Damage, DamageType, HitLocation);
00037	}
00038	
00039	function UsedUp()
00040	{
00041		local Pawn OwnerPawn;
00042	
00043		OwnerPawn = Pawn(Owner);
00044		if ( (OwnerPawn != None) && !OwnerPawn.FootRegion.Zone.bPainZone && OwnerPawn.HeadRegion.Zone.bWaterZone )
00045			OwnerPawn.PainTime = 15;
00046		Owner.AmbientSound = None;
00047		Super.UsedUp();
00048	}
00049		
00050	state Activated
00051	{
00052		function endstate()
00053		{
00054	
00055			Owner.PlaySound(DeactivateSound);
00056			Owner.AmbientSound = None;		
00057			bActive = false;		
00058		}
00059	
00060		function Timer()
00061		{
00062			local float LocalTime;
00063			local Bubble1 b;
00064	
00065			if ( Pawn(Owner) == None )
00066			{
00067				UsedUp();
00068				return;
00069			}
00070			Charge -= 1;
00071			if (Charge<-0) 
00072			{
00073				Pawn(Owner).ClientMessage(ExpireMessage);			
00074				UsedUp();
00075				return;	
00076			}
00077			LocalTime += 0.1;
00078			LocalTime = LocalTime - int(LocalTime);
00079			if ( Pawn(Owner).HeadRegion.Zone.bWaterZone && !Pawn(Owner).FootRegion.Zone.bPainZone ) 
00080			{
00081				Pawn(Owner).PainTime = 1;
00082				if (FRand()<LocalTime) 
00083				{
00084					GetAxes(Pawn(Owner).ViewRotation,X,Y,Z);	
00085					b = Spawn(class'Bubble1', Owner, '', Pawn(Owner).Location
00086						+ 20.0 * X - (FRand()*6+5) * Y - (FRand()*6+5) * Z );
00087					if ( b != None )
00088						b.DrawScale = FRand()*0.1+0.05;
00089				}
00090				if (FRand()<LocalTime) 
00091				{
00092					GetAxes(Pawn(Owner).ViewRotation,X,Y,Z);	
00093					b = Spawn(class'Bubble1', Owner, '', Pawn(Owner).Location
00094						+ 20.0 * X + (FRand()*6+5) * Y - (FRand()*6+5) * Z );
00095					if ( b != None )
00096						b.DrawScale = FRand()*0.1+0.05;
00097				}
00098			}
00099		}
00100	Begin:
00101		if ( Owner == None )
00102			GotoState('');
00103		SetTimer(0.1,True);
00104		if ( Owner.IsA('PlayerPawn') && PlayerPawn(Owner).HeadRegion.Zone.bWaterZone) 
00105			Owner.AmbientSound = ActivateSound;
00106		else 
00107			Owner.AmbientSound = RespawnSound;		
00108	}
00109	
00110	state DeActivated
00111	{
00112	Begin:
00113	
00114	}
00115	
00116	defaultproperties
00117	{
00118	     bActivatable=True
00119	     bDisplayableInv=True
00120	     PickupMessage="You picked up the SCUBA gear"
00121	     RespawnTime=20.000000
00122	     PickupViewMesh=LodMesh'UnrealShare.Scuba'
00123	     Charge=1200
00124	     PickupSound=Sound'UnrealShare.Pickups.GenPickSnd'
00125	     ActivateSound=Sound'UnrealShare.Pickups.Scubal1'
00126	     DeActivateSound=Sound'UnrealShare.Pickups.Scubada1'
00127	     RespawnSound=Sound'UnrealShare.Pickups.Scubal2'
00128	     Icon=Texture'UnrealShare.Icons.I_Scuba'
00129	     RemoteRole=ROLE_DumbProxy
00130	     Mesh=LodMesh'UnrealShare.Scuba'
00131	     SoundRadius=16
00132	     CollisionRadius=18.000000
00133	     CollisionHeight=15.000000
00134	}

End Source Code