XIII
Class Beret

source: C:\XIII\XIII\Classes\beret.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Inventory
         |
         +--XIII.Beret
Direct Known Subclasses:BeretJungle, BeretSnow

class Beret
extends Engine.Inventory

//----------------------------------------------------------- // //-----------------------------------------------------------
Variables
 name BoneToAttach


Function Summary
 void AttachToPawn(Pawn P)
     
//_____________________________________________________________________________
 void GiveTo(Pawn Other)
     
//_____________________________________________________________________________
 void NotifyOwnerKilled(Controller Killer)
     
//_____________________________________________________________________________
// My owner has been killed, maybe make me go off



Source Code


00001	//-----------------------------------------------------------
00002	//
00003	//-----------------------------------------------------------
00004	class Beret extends Inventory;
00005	
00006	var name BoneToAttach;
00007	
00008	//_____________________________________________________________________________
00009	function GiveTo( pawn Other )
00010	{
00011	    if ( Other.IsPlayerPawn() )
00012	    {
00013	      Destroy();
00014	      return;
00015	    }
00016	    Super.GiveTo(other);
00017	    AttachToPawn(Other);
00018	}
00019	
00020	//_____________________________________________________________________________
00021	function AttachToPawn(Pawn P)
00022	{
00023	  	if ( ThirdPersonActor == None )
00024	  	{
00025	  		ThirdPersonActor = Spawn(AttachmentClass,Owner);
00026	  		InventoryAttachment(ThirdPersonActor).InitFor(self);
00027	  	}
00028	  	P.AttachToBone(ThirdPersonActor,BoneToAttach);
00029	  	ThirdPersonActor.SetRelativeLocation(ThirdPersonRelativeLocation);
00030	  	ThirdPersonActor.SetRelativeRotation(ThirdPersonRelativeRotation);
00031	}
00032	
00033	//_____________________________________________________________________________
00034	// My owner has been killed, maybe make me go off
00035	function NotifyOwnerKilled(controller Killer)
00036	{
00037	    local BeretFlying BF;
00038	
00039	    BF = Spawn(class'BeretFlying',,,ThirdPersonActor.Location, ThirdPersonActor.Rotation);
00040	    BF.CalcVelocity( 1000.0*Normal(Killer.Pawn.Location - Owner.Location) );
00041	    BF.StaticMesh = AttachmentClass.default.StaticMesh;
00042	    DetachFromPawn(Pawn(Owner));
00043	}
00044	
00045	
00046	
00047	defaultproperties
00048	{
00049	     BoneToAttach="X Head"
00050	     ThirdPersonRelativeLocation=(X=9.700000,Y=-1.500000,Z=-1.050000)
00051	     ThirdPersonRelativeRotation=(Pitch=-16384,Yaw=1550)
00052	     AttachmentClass=Class'XIII.BeretAttachment'
00053	}

End Source Code