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

UTGame.UTProj_LoadedRocket


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
/**
 * Copyright 1998-2008 Epic Games, Inc. All Rights Reserved.
 */

class UTProj_LoadedRocket extends UTProj_Rocket;

/** Used for the curling rocket effect */

var repnotify byte FlockIndex;
var UTProj_LoadedRocket Flock[2];

var() float	FlockRadius;
var() float	FlockStiffness;
var() float FlockMaxForce;
var() float	FlockCurlForce;
var bool bCurl;
var vector Dir;

replication
{
	if ( bNetInitial && (Role == ROLE_Authority) )
		FlockIndex, bCurl;
}


simulated function Destroyed()
{
	ClearTimer('FlockTimer');
	super.Destroyed();
}

simulated event ReplicatedEvent(name VarName)
{
	local UTProj_LoadedRocket R;
	local int i;

	if ( VarName == 'FlockIndex' )
	{
		if ( FlockIndex != 0 )
		{
			SetTimer(0.1, true, 'FlockTimer');

			// look for other rockets
			if ( Flock[1] == None )
			{
				ForEach DynamicActors(class'UTProj_LoadedRocket',R)
					if ( R.FlockIndex == FlockIndex )
					{
						Flock[i] = R;
						if ( R.Flock[0] == None )
							R.Flock[0] = self;
						else if ( R.Flock[0] != self )
							R.Flock[1] = self;
						i++;
						if ( i == 2 )
							break;
					}
			}
		}
	}
	else
	{
		Super.ReplicatedEvent(VarName);
	}
}

simulated function FlockTimer()
{
	local vector ForceDir, CurlDir;
	local float ForceMag;
	local int i;

	// initialize Dir, if necessary
	if (IsZero(Dir))
	{
		Dir = Normal(Velocity);
	}

	Velocity = Default.Speed * Normal(Dir * 0.5 * Default.Speed + Velocity);

	// Work out force between flock to add madness
	for(i=0; i<2; i++)
	{
		if(Flock[i] == None)
			continue;

		// Attract if distance between rockets is over 2*FlockRadius, repulse if below.
		ForceDir = Flock[i].Location - Location;
		ForceMag = FlockStiffness * ( (2 * FlockRadius) - VSize(ForceDir) );
		Acceleration = Normal(ForceDir) * Min(ForceMag, FlockMaxForce);

		// Vector 'curl'
		CurlDir = Flock[i].Velocity Cross ForceDir;
		if ( bCurl == Flock[i].bCurl )
			Acceleration += Normal(CurlDir) * FlockCurlForce;
		else
			Acceleration -= Normal(CurlDir) * FlockCurlForce;
	}
}

defaultproperties
{
   FlockRadius=12.000000
   FlockStiffness=-40.000000
   FlockMaxForce=600.000000
   FlockCurlForce=450.000000
   CheckRadius=20.000000
   Begin Object Class=CylinderComponent Name=CollisionCylinder ObjName=CollisionCylinder Archetype=CylinderComponent'UTGame.Default__UTProj_Rocket:CollisionCylinder'
      ObjectArchetype=CylinderComponent'UTGame.Default__UTProj_Rocket:CollisionCylinder'
   End Object
   CylinderComponent=CollisionCylinder
   Components(0)=CollisionCylinder
   CollisionComponent=CollisionCylinder
   Name="Default__UTProj_LoadedRocket"
   ObjectArchetype=UTProj_Rocket'UTGame.Default__UTProj_Rocket'
}

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