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

UnrealShare.SparkBit


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
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
//=============================================================================
// SparkBit.
//=============================================================================
class SparkBit extends Effects;

#exec MESH IMPORT MESH=bolt1 ANIVFILE=MODELS\bolt1_a.3D DATAFILE=MODELS\bolt1_d.3D X=0 Y=0 Z=0
#exec MESH ORIGIN MESH=bolt1 X=0 Y=0 Z=-0 YAW=64
#exec MESH SEQUENCE MESH=bolt1 SEQ=All    STARTFRAME=0   NUMFRAMES=1
#exec MESH SEQUENCE MESH=bolt1 SEQ=Still  STARTFRAME=0   NUMFRAMES=1
#exec TEXTURE IMPORT NAME=Jmisc1 FILE=MODELS\misc.PCX 
#exec MESHMAP SCALE MESHMAP=bolt1 X=0.05 Y=0.05 Z=0.1
#exec MESHMAP SETTEXTURE MESHMAP=bolt1 NUM=1 TEXTURE=Jmisc1

// Owner (spawner) specifies the velocity of the SparkBit (implicitly in
// Actor properties), the length of time it can burn for, and the initial 
// brightness of the spark.  MZM

var float BurnTime;
var float InitialBrightness;
var float PassedTime;

auto state Burning
{
    simulated function Timer() 
    {
        // The Spark should lose its brightness as it
        // burns away, but not linearly - the main brightness
        // decays in quadratic fashion but the actual brightness
        // is also randomly tweaked to give the appearance of
        // non-uniform burning.  The object also gives off
        // its own light.
        //
        local float tempBrightness;

        BurnTime -= 0.15;
        if ( BurnTime < 0 )
        {
            Destroy();
            return;
        }

        PassedTime += 0.15;
        tempBrightness = InitialBrightness*(1-
                        ((PassedTime*(1-0.1+0.2*FRand()))/BurnTime) **2);
        tempBrightness = FClamp (tempBrightness, 0, 1);
        
        LightBrightness = tempBrightness * 90;
        AmbientGlow     = tempBrightness * 240;

    }

    simulated function HitWall (vector HitNormal, actor Wall) 
    {
        // When surface is hit, the spark appears to become
        // brighter, losing size, but still bounces off (losing half its speed).
        //
        InitialBrightness *= 1.5;
        DrawScale         /= 1.5;
        Velocity = 0.5*(-(Velocity dot HitNormal)*HitNormal*2 + Velocity);
        if ( (HitNormal.Z > 0.7) && (VSize(Velocity) < 50) )
            bBounce = false;
    }
    
    simulated function ZoneChange (ZoneInfo NewZone) 
    {
        // Spark dies if it hits the water.
        //
        if (NewZone.bWaterZone) Destroy();
    }

    simulated function BeginState()
    {
        SetTimer(0.15, true);
        BurnTime = FMax(BurnTime, 0.1);
    }
}

defaultproperties
{
     BurnTime=0.100000
     bNetOptional=True
     Physics=PHYS_Falling
     RemoteRole=ROLE_SimulatedProxy
     DrawType=DT_Mesh
     Texture=None
     DrawScale=0.300000
     AmbientGlow=123
     bUnlit=True
     CollisionRadius=1.000000
     CollisionHeight=1.000000
     bCollideActors=True
     bCollideWorld=True
     LightType=LT_Steady
     LightBrightness=130
     LightHue=120
     LightSaturation=200
     LightRadius=1
     bBounce=True
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: za 22-4-2006 13:00:12.000 - Creation time: za 22-4-2006 13:01:33.937 - Created with UnCodeX