Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames

UTGame.UTVehicleBoostPad


00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
/**
 *
 * Copyright 1998-2008 Epic Games, Inc. All Rights Reserved.
 */

class UTVehicleBoostPad extends Actor
	placeable;

var()	bool						bInitiallyOn;
var() 	float						BoostPower, BoostDamping;
var()	array<class<UTVehicle> >	AffectedVehicles;

var		bool 						bCurrentlyActive;
var		array<UTVehicle>			VehicleList;

simulated event PostBeginPlay()
{
	bCurrentlyActive = bInitiallyOn;

	// ttp 113322: Make sure the box is always hidden
	CollisionComponent.SetHidden(true);

	Disable('Tick');
}

function Trigger( Actor Other, Pawn EventInstigator )
{
	bCurrentlyActive = !bCurrentlyActive;
}

event Touch(Actor Other, PrimitiveComponent OtherComp, vector HitLocation, vector HitNormal)
{
	local bool bFound;
	local UTVehicle UTV;

	UTV = UTVehicle(Other);

	if (UTV != None && bCurrentlyActive)
	{
		if (AffectedVehicles.Length > 0)
			bFound = (AffectedVehicles.Find(UTV.Class) != -1);
		else
			bFound = TRUE;
	}

	if (bFound)
	{
		VehicleList[VehicleList.Length] = UTV;
		Enable('Tick');

		// If we have a sound to play, and not dedicated server, play it
		if(WorldInfo.NetMode != NM_DedicatedServer && UTV.BoostPadSound != None)
		{
			PlaySound(UTV.BoostPadSound, TRUE, , , UTV.Location);
		}
	}
}

event UnTouch(Actor Other)
{
	local int Idx;
	local UTVehicle UTV;

	UTV = UTVehicle(Other);

	if (UTV != None)
	{
		Idx = VehicleList.Find(UTV);

		if (Idx >= 0)
			VehicleList.Remove(Idx, 1);
	}
}

simulated function vector CalculateForce(vector CarLocation, vector CarVelocity)
{
	local vector X,Y,Z;
	local vector BoostForce, BoostNormal;

	GetAxes(rotation, X, Y, Z);

	BoostForce = X * BoostPower;
	BoostNormal = Normal(BoostForce);

	BoostForce -= BoostNormal * (CarVelocity dot BoostNormal) * BoostDamping;

	return BoostForce;
}

function Tick(float DT)
{
	local vector CalculatedForce;
	local int i;

	if (VehicleList.Length == 0)
		Disable('Tick');

	if (bCurrentlyActive)
	{
		for (i = 0; i < VehicleList.Length; i++)
		{
			CalculatedForce = CalculateForce(VehicleList[i].Location, VehicleList[i].Velocity);
			VehicleList[i].Mesh.AddForce(CalculatedForce);
		}
	}
}

defaultproperties
{
   bInitiallyOn=True
   BoostPower=1500.000000
   BoostDamping=0.010000
   Begin Object Class=ArrowComponent Name=ArrowComponent0 ObjName=ArrowComponent0 Archetype=ArrowComponent'Engine.Default__ArrowComponent'
      ArrowColor=(B=128,G=255,R=0,A=255)
      ArrowSize=5.500000
      Name="ArrowComponent0"
      ObjectArchetype=ArrowComponent'Engine.Default__ArrowComponent'
   End Object
   Components(0)=ArrowComponent0
   Begin Object Class=StaticMeshComponent Name=StaticMeshComponent0 ObjName=StaticMeshComponent0 Archetype=StaticMeshComponent'Engine.Default__StaticMeshComponent'
      StaticMesh=StaticMesh'UN_SimpleMeshes.TexPropCube_Dup'
      Materials(0)=Material'Envy_Effects.Energy.Materials.M_EFX_Energy_Loop_Scroll_01'
      HiddenGame=True
      bUseAsOccluder=False
      CastShadow=False
      bAcceptsLights=False
      BlockActors=False
      BlockZeroExtent=False
      BlockRigidBody=False
      Scale3D=(X=2.000000,Y=1.000000,Z=0.400000)
      Name="StaticMeshComponent0"
      ObjectArchetype=StaticMeshComponent'Engine.Default__StaticMeshComponent'
   End Object
   Components(1)=StaticMeshComponent0
   bAlwaysRelevant=True
   bCollideActors=True
   CollisionComponent=StaticMeshComponent0
   CollisionType=COLLIDE_CustomDefault
   Name="Default__UTVehicleBoostPad"
   ObjectArchetype=Actor'Engine.Default__Actor'
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: tr 31-1-2018 17:18:50.000 - Creation time: sk 18-3-2018 10:01:28.170 - Created with UnCodeX