Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames

UnrealShare.Sparks


00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
//=============================================================================
// Sparks.
//=============================================================================
class Sparks expands Effects;

// Spawns off a number of SparkBit elements, which all die out
// within a random amount of time.  MZM
                                // Reasonable defaults
var() float    MinBetweenTime;      // 0.4
var() float    MaxBetweenTime;      // 1.0
var() int      MinSpawnedAtOnce;    // 1
var() int      MaxSpawnedAtOnce;    // 3
var() float    MinSpawnSpeed;       // 200
var() float    MaxSpawnSpeed;       // 300
var() float    MinBurnTime;     // 0.4
var() float    MaxBurnTime;     // 1.0
var() float    MinBrightness;       // 0.7	(values can only go from 0.0 -> 1.0)
var() float    MaxBrightness;       // 1.0    "							   "
var() rotator  SpawnCenterDir;
var() int      AngularDeviation;    // approx. 0x2000 -> 8192

var   float    NextSparkTime;
var   int     NumSpawnedNow;
var   int     i;

auto state StartState {

    function MoreSparks () {

        local SparkBit TempSparkBit;
        local rotator SpawnDir;

        // Time to generate another SparkBit.
        TempSparkBit = Spawn (class 'SparkBit', , '', Location);

        SpawnDir = SpawnCenterDir;
        SpawnDir.Pitch += -AngularDeviation + Rand(AngularDeviation*2);
        SpawnDir.Yaw   += -AngularDeviation + Rand(AngularDeviation*2);
        TempSparkBit.Velocity = Vector(SpawnDir)*(MinSpawnSpeed + 
                                 FRand()*(MaxSpawnSpeed-MinSpawnSpeed));

        //TempSparkBit.Velocity = Normal(VRand())*(MinSpawnSpeed + 
        //                         FRand()*(MaxSpawnSpeed-MinSpawnSpeed));
        TempSparkBit.BurnTime = MinBurnTime + FRand()*(MaxBurnTime-MinBurnTime);

        // 0=dark  1=bright
        TempSparkBit.InitialBrightness = MinBrightness + 
                                       FRand()*(MaxBrightness-MinBrightness);
    }

Begin:

    if (minBetweenTime >= maxBetweenTime) maxBetweenTime=minBetweenTime + 0.1;

Loop:

    //Log ("Making more sparks");
    NumSpawnedNow = Rand(MaxSpawnedAtOnce-MinSpawnedAtOnce+1)+MinSpawnedAtOnce;
    for (i=0; i<NumSpawnedNow; i++)
        MoreSparks();

    NextSparkTime = FRand()*(MaxBetweenTime-MinBetweenTime)+ MinBetweenTime;
    //Log ("Next spark(s) in " $ NextSparkTime);
    Sleep (NextSparkTime);
    goto 'Loop';
}

defaultproperties
{
     MinBetweenTime=0.400000
     MaxBetweenTime=1.000000
     MinSpawnedAtOnce=1
     MaxSpawnedAtOnce=3
     MinSpawnSpeed=200.000000
     MaxSpawnSpeed=300.000000
     MinBurnTime=0.400000
     MaxBurnTime=1.000000
     MinBrightness=0.700000
     MaxBrightness=1.000000
     bHidden=True
     bNetTemporary=False
     LifeSpan=1000.000000
     DrawType=DT_Mesh
     Mesh=Mesh'UnrealShare.bolt1'
     LightBrightness=78
     LightHue=96
     LightSaturation=224
     LightRadius=4
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Sun 21/2/2010 23:48:40.000 - Creation time: Sun 21/2/2010 23:49:53.724 - Created with UnCodeX