Variables |
vector |
CubeDimensions |
rotator |
InitialDirection
Is there a limit on it's lifespan? |
float |
MaxBetweenTime
Is there a limit on it's lifespan? |
float |
MaxScaleFactor
Is there a limit on it's lifespan? |
float |
MinBetweenTime
Is there a limit on it's lifespan? |
float |
MinScaleFactor
Is there a limit on it's lifespan? |
float |
NextRockTime
Is there a limit on it's lifespan? |
float |
TimeLength
Is there a limit on it's lifespan? |
bool |
TimeLimit
Is there a limit on it's lifespan? |
float |
TotalPassedTime
Is there a limit on it's lifespan? |
float |
maxInitialSpeed
Is there a limit on it's lifespan? |
float |
minInitialSpeed
Is there a limit on it's lifespan? |
States |
Active |
State Active Function Summary |
Source Code
00001 //=============================================================================
00002 // RockSlide.
00003 //=============================================================================
00004 class RockSlide extends KeyPoint;
00005
00006 // Spawns a set of rocks within a cubical volume. The rocks are
00007 // produced at random intervals, and the entirety of the effect
00008 // lasts for a set amount of time. MZM
00009
00010 var() vector CubeDimensions;
00011 var() bool TimeLimit; // Is there a limit on it's lifespan?
00012 var() float TimeLength;
00013 var() float MinBetweenTime;
00014 var() float MaxBetweenTime;
00015 var() float MinScaleFactor;
00016 var() float MaxScaleFactor;
00017 var() rotator InitialDirection;
00018 var() float minInitialSpeed;
00019 var() float maxInitialSpeed;
00020
00021 var float NextRockTime;
00022 var float TotalPassedTime;
00023
00024
00025 function BeginPlay()
00026 {
00027 // Initialize and check the values of variables.
00028 MaxScaleFactor = FMin(1.0, MaxScaleFactor);
00029 MinScaleFactor = FMax(0.0, MinScaleFactor);
00030 if (MinBetweenTime >= MaxBetweenTime)
00031 MaxBetweenTime=MinBetweenTime + 0.1;
00032 if (MinScaleFactor >= MaxScaleFactor)
00033 MaxScaleFactor=MinScaleFactor;
00034
00035 Super.BeginPlay();
00036 }
00037
00038 function MakeRock ()
00039 {
00040 // Spawns another rock somewhere within the cube,
00041 // of a randomized size and shape. The rock has
00042 // falling physics but no initial velocity, so it
00043 // needs to fall a distance before it becomes dangerous.
00044
00045 local vector SpawnLoc;
00046 local BigRock TempRock;
00047
00048 SpawnLoc = Location - (CubeDimensions*0.5);
00049 SpawnLoc.X += FRand()*CubeDimensions.X;
00050 SpawnLoc.Y += FRand()*CubeDimensions.Y;
00051 SpawnLoc.Z += FRand()*CubeDimensions.Z;
00052
00053 TempRock = Spawn (class 'BigRock', ,'', SpawnLoc);
00054 if ( TempRock != None )
00055 {
00056 TempRock.SetRotation(InitialDirection);
00057 TempRock.Speed = (MinInitialSpeed+
00058 (MaxInitialSpeed-MinInitialSpeed)*FRand());
00059
00060 TempRock.DrawScale = (MaxScaleFactor-MinScaleFactor)*FRand()+MinScaleFactor;
00061 TempRock.SetCollisionSize(TempRock.CollisionRadius*TempRock.DrawScale/TempRock.Default.DrawScale,
00062 TempRock.CollisionHeight*TempRock.DrawScale/TempRock.Default.DrawScale);
00063 }
00064 }
00065
00066 auto state() Triggered
00067 {
00068 function Trigger (actor Other, pawn EventInstigator)
00069 {
00070 MakeRock();
00071 GotoState ('Active');
00072 }
00073 }
00074
00075 state Active
00076 {
00077 Begin:
00078 // A loop which lasts for the total time allowed for the
00079 // effect, producing rocks at randomized intervals.
00080 MakeRock();
00081 NextRockTime = FRand()*(MaxBetweenTime-MinBetweenTime)+ MinBetweenTime;
00082 TotalPassedTime += NextRockTime;
00083 sleep (NextRockTime);
00084 if ( !TimeLimit || (TotalPassedTime < TimeLength) )
00085 goto 'RocksFall';
00086 Destroy();
00087 }
00088
00089 defaultproperties
00090 {
00091 CubeDimensions=(X=50.000000,Y=50.000000,Z=50.000000)
00092 TimeLength=10.000000
00093 MinBetweenTime=1.000000
00094 MaxBetweenTime=3.000000
00095 MinScaleFactor=0.500000
00096 MaxScaleFactor=1.000000
00097 bStatic=False
00098 Tag=Event1
00099 Texture=Texture'UnrealShare.S_Bubble2'
00100 }
|
End Source Code