UnrealShare
Class Earthquake

source: e:\games\UnrealTournament\UnrealShare\Classes\Earthquake.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Keypoint
         |
         +--UnrealShare.Earthquake
Direct Known Subclasses:CH_Earthquake

class Earthquake
extends Engine.Keypoint

//============================================================================= // Earthquake. // note - this just shakes the players. Trigger other effects directly //=============================================================================
Variables
 bool bThrowPlayer
 float duration
 float magnitude
 float radius
 float remainingTime


Function Summary
 void Timer()
 void Trigger(Actor Other, Pawn EventInstigator)



Source Code


00001	//=============================================================================
00002	// Earthquake.
00003	// note - this just shakes the players.  Trigger other effects directly
00004	//=============================================================================
00005	class Earthquake extends Keypoint;
00006	
00007	var() float magnitude;
00008	var() float duration;
00009	var() float radius;
00010	var() bool bThrowPlayer;
00011	var   float remainingTime;
00012	
00013		function Trigger(actor Other, pawn EventInstigator)
00014		{
00015			local Pawn P;
00016			local vector throwVect;
00017			if (bThrowPlayer)
00018			{
00019				throwVect = 0.18 * Magnitude * VRand();
00020				throwVect.Z = FMax(Abs(ThrowVect.Z), 120);
00021			} 
00022			P = Level.PawnList;
00023			while ( P != None )
00024			{
00025				if ( (PlayerPawn(P) != None) && (VSize(Location - P.Location) < radius) )
00026				{
00027					if (bThrowPlayer && (P.Physics != PHYS_Falling) )
00028						P.AddVelocity(throwVect);
00029					PlayerPawn(P).ShakeView(duration, magnitude, 0.015 * magnitude);
00030				}
00031				P = P.nextPawn;
00032			}
00033			if ( bThrowPlayer && (duration > 0.5) )
00034			{
00035				remainingTime = duration;
00036				SetTimer(0.5, false);
00037			}
00038		}
00039	
00040		function Timer()
00041		{
00042			local vector throwVect;
00043			local Pawn P;
00044			
00045			remainingTime -= 0.5;
00046			throwVect = 0.15 * Magnitude * VRand();
00047			throwVect.Z = FMax(Abs(ThrowVect.Z), 120);
00048	
00049			P = Level.PawnList;
00050			while ( P != None )
00051			{
00052				if ( (PlayerPawn(P) != None) && (VSize(Location - P.Location) < radius) )
00053				{
00054					if ( P.Physics != PHYS_Falling )
00055						P.AddVelocity(ThrowVect);
00056					P.BaseEyeHeight = FMin(P.Default.BaseEyeHeight, P.BaseEyeHeight * (0.5 + FRand()));
00057					PlayerPawn(P).ShakeView(remainingTime, magnitude, 0.015 * magnitude);
00058				}
00059				P = P.nextPawn;
00060			}
00061				
00062			if ( remainingTime > 0.5 )
00063				SetTimer(0.5, false);
00064		}	
00065	
00066	defaultproperties
00067	{
00068	     magnitude=2000.000000
00069	     duration=5.000000
00070	     Radius=300.000000
00071	     bThrowPlayer=True
00072	     bStatic=False
00073	}

End Source Code