Botpack
Class UT_SeekingRocket

source: e:\games\UnrealTournament\Botpack\Classes\UT_SeekingRocket.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Projectile
         |
         +--Botpack.RocketMk2
            |
            +--Botpack.UT_SeekingRocket
Direct Known Subclasses:None

class UT_SeekingRocket
extends Botpack.RocketMk2

//============================================================================= // SeekingRocket. //=============================================================================
Variables
 vector InitialDir
 Actor Seeking


Function Summary
 
simulated
PostBeginPlay()
 
simulated
Timer()



Source Code


00001	//=============================================================================
00002	// SeekingRocket.
00003	//=============================================================================
00004	class UT_SeekingRocket extends RocketMk2;
00005	
00006	var Actor Seeking;
00007	var vector InitialDir;
00008	
00009	replication
00010	{
00011		// Relationships.
00012		reliable if( Role==ROLE_Authority )
00013			Seeking, InitialDir;
00014	}
00015	
00016	simulated function Timer()
00017	{
00018		local ut_SpriteSmokePuff b;
00019		local vector SeekingDir;
00020		local float MagnitudeVel;
00021	
00022		if ( InitialDir == vect(0,0,0) )
00023			InitialDir = Normal(Velocity);
00024			 
00025		if ( (Seeking != None) && (Seeking != Instigator) ) 
00026		{
00027			SeekingDir = Normal(Seeking.Location - Location);
00028			if ( (SeekingDir Dot InitialDir) > 0 )
00029			{
00030				MagnitudeVel = VSize(Velocity);
00031				SeekingDir = Normal(SeekingDir * 0.5 * MagnitudeVel + Velocity);
00032				Velocity =  MagnitudeVel * SeekingDir;	
00033				Acceleration = 25 * SeekingDir;	
00034				SetRotation(rotator(Velocity));
00035			}
00036		}
00037		if ( bHitWater || (Level.NetMode == NM_DedicatedServer) )
00038			Return;
00039	
00040		if ( (Level.bHighDetailMode && !Level.bDropDetail) || (FRand() < 0.5) )
00041		{
00042			b = Spawn(class'ut_SpriteSmokePuff');
00043			b.RemoteRole = ROLE_None;
00044		}
00045	}
00046	
00047	simulated function PostBeginPlay()
00048	{
00049		Super.PostBeginPlay();
00050		SetTimer(0.1, true);
00051	}
00052	
00053	defaultproperties
00054	{
00055	     LifeSpan=10.000000
00056	}

End Source Code