Engine
Class Vehicle

source: C:\XIII\Engine\Classes\Vehicle.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Pawn
         |
         +--Engine.Vehicle
Direct Known Subclasses:None

class Vehicle
extends Engine.Pawn


Variables
 int NumParts
 class PartClass[16]
 vector PartOffset[16]
 VehiclePart VehicleParts[16]
 bool bActivated
 bool bUpdating
           true if any parts are updating

States
Startup

Function Summary
 bool PointOfView()
     
/* PointOfView()
called by controller when possessing this vehicle
true (3rd person) for vehicles by default
*/
 void PostBeginPlay()
 void Tick(Float DeltaTime)


State Startup Function Summary
 void Tick(Float DeltaTime)



Source Code


00001	class Vehicle extends Pawn
00002		abstract
00003		native;
00004	
00005	var class<VehiclePart> PartClass[16];
00006	var VehiclePart VehicleParts[16];
00007	var vector PartOffset[16];
00008	var int NumParts;
00009	
00010	var bool bActivated;
00011	var bool bUpdating;		// true if any parts are updating
00012	
00013	function PostBeginPlay()
00014	{
00015		local int i;
00016		local vector RotX, RotY, RotZ;
00017	
00018		Super.PostBeginPlay();
00019	
00020		GetAxes(Rotation,RotX,RotY,RotZ);
00021	
00022		for ( i=0; i<16; i++ )
00023		{
00024			if ( PartClass[i] != None )
00025			{
00026				VehicleParts[i] = spawn(PartClass[i],self,,Location+PartOffset[i].X * RotX + PartOffset[i].Y * RotY + PartOffset[i].Z * RotZ);
00027				if ( VehicleParts[i] == None )
00028					log("WARNING - "$PartClass[i]$" failed to spawn for "$self);
00029				VehicleParts[i].SetRotation(Rotation);
00030				VehicleParts[i].SetBase(self);
00031				NumParts++;
00032			}
00033			else
00034				break;
00035		}
00036	}
00037	
00038	/* PointOfView()
00039	called by controller when possessing this vehicle
00040	true (3rd person) for vehicles by default
00041	*/
00042	simulated function bool PointOfView()
00043	{
00044		return true;
00045	}
00046	
00047	function Tick(Float DeltaTime)
00048	{
00049		local int i;
00050		
00051		bUpdating = false;
00052		for ( i=0; i<NumParts; i++ )
00053			if ( (VehicleParts[i] != None) && VehicleParts[i].bUpdating )
00054			{
00055				VehicleParts[i].Update(DeltaTime);
00056				bUpdating = true;
00057			}
00058	
00059		if ( bUpdating )
00060		{
00061			if ( Physics == PHYS_None )
00062				SetPhysics(PHYS_Rotating);
00063		}
00064	//	else if ( Physics == PHYS_Rotating )
00065	//		SetPhysics(PHYS_None);
00066	}
00067	
00068	Auto State Startup
00069	{
00070		function Tick(Float DeltaTime)
00071		{
00072			local int i;
00073			
00074			bUpdating = false;
00075			for ( i=0; i<NumParts; i++ )
00076				if ( (VehicleParts[i] != None) && VehicleParts[i].bUpdating )
00077				{
00078					VehicleParts[i].Update(DeltaTime);
00079					bUpdating = true;
00080				}
00081		}
00082	
00083	Begin:
00084		GotoState('');
00085	}
00086	
00087	defaultproperties
00088	{
00089	     ControllerClass=None
00090	     bOwnerNoSee=False
00091	     Physics=PHYS_Flying
00092	}

End Source Code