Core.Object | +--Engine.Actor | +--Engine.Projectile | +--RuneI.Seeker
float
ConvergeFactor
Pawn
TargetPawn
TimeToDamage
ParticleSystem
Trail
simulated
Destroyed()
Explode(vector HitLocation, vector HitNormal)
HitWall(vector HitNormal, Actor Wall)
PreBeginPlay()
ProcessTouch(Actor Other, Vector HitLocation)
Tick(float DeltaTime)
00001 //============================================================================= 00002 // Seeker. 00003 //============================================================================= 00004 class Seeker expands Projectile; 00005 00006 var Pawn TargetPawn; 00007 var ParticleSystem Trail; 00008 var() float ConvergeFactor; 00009 00010 var float TimeToDamage; 00011 00012 simulated function PreBeginPlay() 00013 { 00014 local vector X,Y,Z; 00015 00016 Trail = Spawn(class'SeekerTrail'); 00017 Trail.SetBase(self); 00018 00019 GetAxes(Rotation,X,Y,Z); 00020 Velocity = X * Speed; 00021 } 00022 00023 00024 simulated function Destroyed() 00025 { 00026 Trail.Destroy(); 00027 } 00028 00029 simulated function Tick(float DeltaTime) 00030 { 00031 local vector Dir; 00032 local PlayerPawn aPawn; 00033 local float dist, bestdist; 00034 00035 Super.Tick(DeltaTime); 00036 00037 if (TargetPawn==None || TargetPawn.Health<=0) 00038 { // Find a new target 00039 bestdist = 1000000; 00040 TargetPawn = None; 00041 foreach VisibleCollidingActors(class'PlayerPawn', aPawn, 1000) 00042 { 00043 dist = VSize(aPawn.Location-Location); 00044 if (aPawn != Instigator && aPawn.Health > 0 && dist < bestdist && aPawn.bProjTarget) 00045 { // Target this pawn 00046 TargetPawn = aPawn; 00047 bestdist = dist; 00048 } 00049 } 00050 } 00051 else 00052 { 00053 Dir = Normal( Normal(Velocity) + DeltaTime * ConvergeFactor * Normal(TargetPawn.Location-Location) ); 00054 Velocity = Dir * MaxSpeed; 00055 } 00056 00057 // Code to not allow the seeker to damage constantly while it is touching an actor 00058 if(TimeToDamage > 0) 00059 { 00060 TimeToDamage -= DeltaTime; 00061 } 00062 } 00063 00064 simulated function HitWall (vector HitNormal, actor Wall) 00065 { 00066 Explode(Location, HitNormal); 00067 } 00068 00069 simulated function ProcessTouch(Actor Other, Vector HitLocation) 00070 { 00071 if(Other.IsA('Weapon')) 00072 return; 00073 00074 if(TimeToDamage <= 0) 00075 { 00076 Other.JointDamaged(Damage, Instigator, HitLocation, Velocity, MyDamageType, 0); 00077 TimeToDamage = 1.0; // Only damage every second 00078 ConvergeFactor = 10.000000; 00079 } 00080 00081 00082 if(Other.IsA('Shield')) // The seeker was blocked 00083 Explode(Location, vect(0, 0, 1)); 00084 } 00085 00086 simulated function Explode(vector HitLocation, vector HitNormal) 00087 { 00088 Destroy(); 00089 } 00090 00091 defaultproperties 00092 { 00093 ConvergeFactor=5.000000 00094 speed=500.000000 00095 MaxSpeed=500.000000 00096 Damage=8.000000 00097 MyDamageType=Electricity 00098 LifeSpan=6.000000 00099 SoundRadius=22 00100 SoundVolume=128 00101 AmbientSound=Sound'EnvironmentalSnd.Scifi.scifi03L' 00102 CollisionRadius=10.000000 00103 CollisionHeight=10.000000 00104 bCollideActors=False 00105 }