UnrealShare
Class WoodenBox

source: e:\games\UnrealTournament\UnrealShare\Classes\WoodenBox.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Decoration
         |
         +--UnrealShare.WoodenBox
Direct Known Subclasses:MedWoodBox, SmallWoodBox

class WoodenBox
extends Engine.Decoration

//============================================================================= // WoodenBox. //=============================================================================
Variables
 int FragChunks
 Float Fragsize
 int Health

States
Animate

Function Summary
 void PreBeginPlay()


State Animate Function Summary
 void TakeDamage(int NDamage, Pawn instigatedBy, Vector hitlocation, Vector momentum, name damageType)



Source Code


00001	//=============================================================================
00002	// WoodenBox.
00003	//=============================================================================
00004	class WoodenBox extends Decoration;
00005	
00006	#exec AUDIO IMPORT FILE="sounds\general\bPush1.wav" NAME="ObjectPush" GROUP="General"
00007	#exec AUDIO IMPORT FILE="sounds\general\EndPush.wav" NAME="Endpush" GROUP="General"
00008	
00009	#exec MESH IMPORT MESH=WoodenBoxM ANIVFILE=MODELS\Box_a.3D DATAFILE=MODELS\Box_d.3D X=0 Y=0 Z=0
00010	#exec MESH ORIGIN MESH=WoodenBoxM X=0 Y=0 Z=0 YAW=64
00011	#exec MESH SEQUENCE MESH=WoodenBoxM SEQ=All    STARTFRAME=0   NUMFRAMES=1
00012	#exec MESH SEQUENCE MESH=WoodenBoxM SEQ=Still  STARTFRAME=0   NUMFRAMES=1
00013	#exec TEXTURE IMPORT NAME=JWoodenBox1 FILE=MODELS\Box.PCX GROUP=Skins
00014	#exec MESHMAP SCALE MESHMAP=WoodenBoxM X=0.08 Y=0.08 Z=0.16
00015	#exec MESHMAP SETTEXTURE MESHMAP=WoodenBoxM NUM=1 TEXTURE=JWoodenBox1
00016	
00017	var() int Health;
00018	var() int FragChunks;
00019	var() Float Fragsize;
00020	
00021	function PreBeginPlay()
00022	{
00023		// some boxes will float (randomly)
00024		if ( Buoyancy == Default.Buoyancy)
00025			Buoyancy = Mass * (0.9 + 0.6 * FRand());
00026	
00027		Super.PreBeginPlay();
00028	}
00029	
00030	Auto State Animate
00031	{
00032	
00033		function TakeDamage( int NDamage, Pawn instigatedBy, Vector hitlocation, 
00034							Vector momentum, name damageType)
00035		{
00036			Instigator = InstigatedBy;
00037			if (Health<0) Return;
00038			if ( Instigator != None )
00039				MakeNoise(1.0);
00040			bBobbing = false;
00041			Health -= NDamage;
00042			if (Health <0) 	
00043				Frag(Class'WoodFragments',Momentum,FragSize,FragChunks);		
00044			else 
00045			{
00046				SetPhysics(PHYS_Falling);
00047				Momentum.Z = 1000;
00048				Velocity=Momentum*0.016;
00049			}
00050		}
00051	}
00052	
00053	defaultproperties
00054	{
00055	     Health=20
00056	     FragChunks=12
00057	     Fragsize=1.750000
00058	     bPushable=True
00059	     PushSound=Sound'UnrealShare.General.ObjectPush'
00060	     EndPushSound=Sound'UnrealShare.General.Endpush'
00061	     bStatic=False
00062	     DrawType=DT_Mesh
00063	     Mesh=LodMesh'UnrealShare.WoodenBoxM'
00064	     CollisionRadius=29.000000
00065	     CollisionHeight=26.000000
00066	     bCollideActors=True
00067	     bCollideWorld=True
00068	     bBlockActors=True
00069	     bBlockPlayers=True
00070	     Mass=50.000000
00071	}

End Source Code