Botpack
Class UT_ShellCase

source: e:\games\UnrealTournament\Botpack\Classes\UT_ShellCase.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Projectile
         |
         +--Botpack.UT_ShellCase
Direct Known Subclasses:MiniShellCase

class UT_ShellCase
extends Engine.Projectile

//============================================================================= // ut_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	// ut_ShellCase.
00003	//=============================================================================
00004	class UT_ShellCase extends Projectile;
00005	
00006	#exec MESH IMPORT MESH=Shellc ANIVFILE=MODELS\shellcase_a.3D DATAFILE=MODELS\shellcase_d.3D X=0 Y=0 Z=0
00007	#exec MESH ORIGIN MESH=Shellc X=0 Y=0 Z=0 YAW=192 ROLL=64
00008	#exec MESH SEQUENCE MESH=Shellc SEQ=All  STARTFRAME=0  NUMFRAMES=1
00009	#exec TEXTURE IMPORT NAME=Shellcase1 FILE=MODELS\shellcase.PCX
00010	#exec MESHMAP SCALE MESHMAP=Shellc X=0.007 Y=0.007 Z=0.014
00011	#exec MESHMAP SETTEXTURE MESHMAP=Shellc NUM=1 TEXTURE=Shellcase1 TLOD=30
00012	
00013	var bool bHasBounced;
00014	var int numBounces;
00015	
00016	simulated function PostBeginPlay()
00017	{
00018		Super.PostBeginPlay();
00019		SetTimer(0.1, false);
00020		if ( Level.bDropDetail && (Level.NetMode != NM_DedicatedServer)
00021			&& (Level.NetMode != NM_ListenServer) )
00022			LifeSpan = 1.5;
00023		if ( Level.bDropDetail )
00024			LightType = LT_None;
00025	}
00026	
00027	simulated function Timer()
00028	{
00029		LightType = LT_None;
00030	}
00031	
00032	simulated function HitWall( vector HitNormal, actor Wall )
00033	{
00034		local vector RealHitNormal;
00035	
00036		if ( Level.bDropDetail )
00037		{
00038			Destroy();
00039			return;
00040		}
00041		if ( bHasBounced && ((numBounces > 3) || (FRand() < 0.85) || (Velocity.Z > -50)) )
00042			bBounce = false;
00043		numBounces++;
00044		if ( numBounces > 3 )
00045		{
00046			Destroy();
00047			return;
00048		}
00049		else if ( !Region.Zone.bWaterZone )
00050			PlaySound(sound 'shell2');
00051		RealHitNormal = HitNormal;
00052		HitNormal = Normal(HitNormal + 0.4 * VRand());
00053		if ( (HitNormal Dot RealHitNormal) < 0 )
00054			HitNormal *= -0.5; 
00055		Velocity = 0.5 * (Velocity - 2 * HitNormal * (Velocity Dot HitNormal));
00056		RandSpin(100000);
00057		bHasBounced = True;
00058	}
00059	
00060	simulated function ZoneChange( Zoneinfo NewZone )
00061	{
00062		if (NewZone.bWaterZone && !Region.Zone.bWaterZone) 
00063		{
00064			Velocity=0.2*Velocity;	
00065			PlaySound(sound 'Drip1');			
00066			bHasBounced=True;
00067		}
00068	}
00069	
00070	
00071	simulated function Landed( vector HitNormal )
00072	{
00073		local rotator RandRot;
00074	
00075		if ( Level.bDropDetail )
00076		{
00077			Destroy();
00078			return;
00079		}
00080		if ( !Region.Zone.bWaterZone )
00081			PlaySound(sound 'shell2');
00082		if ( numBounces > 3 )
00083		{
00084			Destroy();
00085			return;
00086		}
00087		
00088		SetPhysics(PHYS_None);
00089		RandRot = Rotation;
00090		RandRot.Pitch = 0;
00091		RandRot.Roll = 0;
00092		SetRotation(RandRot);
00093	}
00094	
00095	function Eject(Vector Vel)
00096	{
00097		Velocity = Vel;
00098		RandSpin(100000);
00099		if ( (Instigator != None) && Instigator.HeadRegion.Zone.bWaterZone ) 
00100		{
00101			Velocity += 0.85 * Instigator.Velocity;
00102			Velocity = Velocity * (0.2+FRand()*0.2);
00103			bHasBounced=True;
00104		}
00105	}
00106	
00107	defaultproperties
00108	{
00109	     MaxSpeed=1000.000000
00110	     bNetOptional=True
00111	     bReplicateInstigator=False
00112	     Physics=PHYS_Falling
00113	     RemoteRole=ROLE_SimulatedProxy
00114	     LifeSpan=3.000000
00115	     Mesh=LodMesh'Botpack.Shellc'
00116	     bUnlit=True
00117	     bCollideActors=False
00118	     LightType=LT_Steady
00119	     LightEffect=LE_NonIncidence
00120	     LightBrightness=250
00121	     LightHue=28
00122	     LightSaturation=128
00123	     LightRadius=7
00124	     bBounce=True
00125	     bFixedRotationDir=True
00126	     NetPriority=1.400000
00127	}

End Source Code