Core.Object | +--Engine.Actor | +--Engine.Effects | +--RuneI.VampireTrail
int
HealthBoost
Sound
HealthBoostSound
SpawnSound
WeaponSwipe
Swipe
class
SwipeClass
float
ToDestVelocity
Pawn
VampireDest
alpha
simulated
Destroyed()
PostBeginPlay()
void
ServerBegin()
ServerReachedDest()
Tick(float DeltaTime)
00001 //============================================================================= 00002 // VampireTrail. 00003 //============================================================================= 00004 class VampireTrail expands Effects; 00005 00006 var WeaponSwipe Swipe; 00007 var() class<WeaponSwipe> SwipeClass; 00008 00009 var Pawn VampireDest; 00010 var float ToDestVelocity; 00011 var float alpha; 00012 var int HealthBoost; 00013 00014 var() Sound SpawnSound; 00015 var() Sound HealthBoostSound; 00016 00017 00018 replication 00019 { 00020 reliable if (ROLE==ROLE_Authority) 00021 VampireDest; 00022 } 00023 00024 function ServerBegin() 00025 { 00026 PlaySound(SpawnSound, SLOT_Misc, 0.6,,, 0.9 + (FRand() * 0.2)); 00027 } 00028 00029 simulated function PostBeginPlay() 00030 { 00031 Super.PostBeginPlay(); 00032 ToDestVelocity = 800 + 200 * FRand(); // velocity to the player 00033 alpha = 0; 00034 00035 Swipe = Spawn(SwipeClass, self,, Location,); 00036 if(Swipe != None) 00037 { 00038 Swipe.RemoteRole=ROLE_None; // Spawn on clients, don't replicate 00039 Swipe.BaseJointIndex = JointNamed('one'); 00040 Swipe.OffsetJointIndex = JointNamed('two'); 00041 Swipe.SystemLifeSpan = -1; 00042 Swipe.SwipeSpeed = 2; 00043 AttachActorToJoint(Swipe, JointNamed('one')); 00044 } 00045 00046 ServerBegin(); 00047 } 00048 00049 simulated function Destroyed() 00050 { 00051 if (Swipe!=None) 00052 Swipe.Destroy(); 00053 } 00054 00055 function ServerReachedDest() 00056 { 00057 Spawn(Class'VampireReplenish',,, Location); 00058 00059 // Flash the screen if the actor receiving the health is a Player 00060 if(VampireDest.IsA('PlayerPawn')) 00061 PlayerPawn(VampireDest).ClientFlash(-0.100, vect(200, 50, 50)); 00062 00063 // Give health to the actor when struck (TODO: Remote Server function call) 00064 if(VampireDest.Health > 0) 00065 { 00066 VampireDest.Health += HealthBoost; 00067 if(VampireDest.Health > VampireDest.MaxHealth) 00068 VampireDest.Health = VampireDest.MaxHealth; 00069 } 00070 00071 PlaySound(HealthBoostSound, SLOT_Misc, 0.6,,, 0.9 + (FRand() * 0.2)); 00072 } 00073 00074 simulated function Tick(float DeltaTime) 00075 { 00076 local vector toDest; 00077 local float dist; 00078 local vector v; 00079 00080 if(VampireDest == None) 00081 { 00082 // Destroy(); 00083 return; 00084 } 00085 00086 alpha += DeltaTime * 0.8; 00087 if(alpha > 1.0) 00088 alpha = 1.0; 00089 00090 toDest = VampireDest.Location - Location; 00091 if(VSize(toDest) < 20) 00092 { 00093 ServerReachedDest(); 00094 Destroy(); 00095 return; 00096 } 00097 00098 v = Velocity * (1.0 - alpha) + (ToDestVelocity * Normal(toDest)) * alpha + VRand() * 40; 00099 Velocity += Acceleration * DeltaTime; 00100 00101 if(VSize(v) > 1000) 00102 v = 1000 * Normal(v); 00103 00104 SetLocation(Location + v * DeltaTime); 00105 } 00106 00107 defaultproperties 00108 { 00109 SwipeClass=Class'RuneI.WeaponSwipeVampHealthTrail' 00110 SpawnSound=Sound'OtherSnd.Pickups.pickup04' 00111 HealthBoostSound=Sound'OtherSnd.Pickups.pickup01' 00112 RemoteRole=ROLE_SimulatedProxy 00113 DrawType=DT_SkeletalMesh 00114 DrawScale=1.500000 00115 Skeletal=SkelModel'objects.FX_Trail' 00116 }