UnrealShare
Class ShellCase

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

class ShellCase
extends Engine.Projectile

//============================================================================= // ShellCase. //=============================================================================
Variables
 bool bHasBounced
 int numBounces


Function Summary
 void Eject(Vector Vel)
 
simulated
HitWall(vector HitNormal, Actor Wall)
 
simulated
Landed(vector HitNormal)
 
simulated
PostBeginPlay()
 
simulated
Timer()
 
simulated
ZoneChange(ZoneInfo NewZone)



Source Code


00001	//=============================================================================
00002	// ShellCase.
00003	//=============================================================================
00004	class ShellCase extends Projectile;
00005	
00006	#exec MESH IMPORT MESH=Shell ANIVFILE=MODELS\shell_a.3D DATAFILE=MODELS\shell_d.3D X=0 Y=0 Z=0
00007	#exec MESH ORIGIN MESH=Shell X=0 Y=0 Z=0 YAW=64 ROLL=128
00008	#exec MESH SEQUENCE MESH=Shell SEQ=All  STARTFRAME=0  NUMFRAMES=1
00009	#exec TEXTURE IMPORT NAME=Autom1 FILE=MODELS\automag.PCX
00010	#exec MESHMAP SCALE MESHMAP=Shell X=0.011 Y=0.011 Z=0.022
00011	#exec MESHMAP SETTEXTURE MESHMAP=Shell NUM=1 TEXTURE=Autom1 TLOD=30
00012	
00013	#exec AUDIO IMPORT FILE="Sounds\automag\shell2.WAV" NAME="Shell2" GROUP="AutoMag"
00014	#exec AUDIO IMPORT FILE="Sounds\General\Drip.WAV" NAME="Drip1" GROUP="General"
00015	
00016	var bool bHasBounced;
00017	var int numBounces;
00018	
00019	simulated function PostBeginPlay()
00020	{
00021		Super.PostBeginPlay();
00022		SetTimer(0.1, false);
00023	}
00024	
00025	simulated function Timer()
00026	{
00027		LightType = LT_None;
00028	}
00029	
00030	simulated function HitWall( vector HitNormal, actor Wall )
00031	{
00032		local vector RealHitNormal;
00033	
00034		if ( bHasBounced && ((numBounces > 3) || (FRand() < 0.85) || (Velocity.Z > -50)) )
00035			bBounce = false;
00036		numBounces++;
00037		if ( !Region.Zone.bWaterZone )
00038			PlaySound(sound 'shell2');
00039		RealHitNormal = HitNormal;
00040		HitNormal = Normal(HitNormal + 0.4 * VRand());
00041		if ( (HitNormal Dot RealHitNormal) < 0 )
00042			HitNormal *= -0.5; 
00043		Velocity = 0.5 * (Velocity - 2 * HitNormal * (Velocity Dot HitNormal));
00044		RandSpin(100000);
00045		bHasBounced = True;
00046	}
00047	
00048	simulated function ZoneChange( Zoneinfo NewZone )
00049	{
00050		if (NewZone.bWaterZone && !Region.Zone.bWaterZone) 
00051		{
00052			Velocity=0.2*Velocity;	
00053			PlaySound(sound 'Drip1');			
00054			bHasBounced=True;
00055		}
00056	}
00057	
00058	
00059	simulated function Landed( vector HitNormal )
00060	{
00061		local rotator RandRot;
00062	
00063		if ( !Region.Zone.bWaterZone )
00064			PlaySound(sound 'shell2');	
00065		SetPhysics(PHYS_None);
00066		RandRot = Rotation;
00067		RandRot.Pitch = 0;
00068		RandRot.Roll = 0;
00069		SetRotation(RandRot);
00070	}
00071	
00072	function Eject(Vector Vel)
00073	{
00074		Velocity = Vel + 0.8 * Instigator.Velocity;
00075		RandSpin(100000);
00076		if (Instigator.HeadRegion.Zone.bWaterZone) 
00077		{
00078			Velocity = Velocity * (0.2+FRand()*0.2);
00079			bHasBounced=True;
00080		}
00081	}
00082	
00083	defaultproperties
00084	{
00085	     MaxSpeed=1000.000000
00086	     bNetOptional=True
00087	     bReplicateInstigator=False
00088	     Physics=PHYS_Falling
00089	     RemoteRole=ROLE_SimulatedProxy
00090	     LifeSpan=3.000000
00091	     Mesh=LodMesh'UnrealShare.Shell'
00092	     bUnlit=True
00093	     bCollideActors=False
00094	     LightType=LT_Steady
00095	     LightEffect=LE_NonIncidence
00096	     LightBrightness=250
00097	     LightHue=28
00098	     LightSaturation=128
00099	     LightRadius=7
00100	     bBounce=True
00101	     bFixedRotationDir=True
00102	     NetPriority=1.500000
00103	}

End Source Code