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

XWeapons.ShieldEffect3rd


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
class ShieldEffect3rd extends AimedAttachment;

#exec OBJ LOAD FILE=XEffectMat.utx

var float Brightness, DesiredBrightness;
var int HitCount, OldHitCount;
var ShieldSparks Sparks;

replication
{
    unreliable if (Role == ROLE_Authority && !bHidden)
        HitCount; 
}

simulated function Destroyed()
{
    if (Sparks != None)
        Sparks.Destroy();
}

simulated function Flash(int Drain)
{
    if ( Level.NetMode != NM_DedicatedServer )
    {
        if (Sparks == None)
        {
            Sparks = Spawn(class'ShieldSparks');
        }

        if (Instigator != None && Instigator.IsFirstPerson())
        {
            Sparks.SetLocation(Location+Vect(0,0,20)+VRand()*12.0);
            Sparks.SetRotation(Rotation);
            Sparks.mStartParticles = 16;
        }
        else if ( EffectIsRelevant(Location,false) )
        {
            Sparks.SetLocation(Location+VRand()*8.0);
            Sparks.SetRotation(Rotation);
            Sparks.mStartParticles = 16;
        }
    }
    Brightness = FMin(Brightness + Drain / 2, 250.0);
    Skins[0] = Skins[1];
    SetTimer(0.2, false);
}

simulated function Timer()
{
    Skins[0] = default.Skins[0];
}

function SetBrightness(int b, bool hit) // server only please
{
    DesiredBrightness = FMin(50+b*2, 250.0);
    if (hit)
    {
        HitCount++;
        Flash(50);
    }
}

simulated function PostNetReceive()
{
    if (OldHitCount == -1)
    {
        OldHitCount = HitCount;
    }
    else if (HitCount != OldHitCount)
    {
        Flash(50);
        OldHitCount = HitCount;
    }
}

defaultproperties
{
     Brightness=250.000000
     DesiredBrightness=250.000000
     OldHitCount=-1
     BaseOffset=(Z=10.000000)
     AimedOffset=(X=28.000000,Y=28.000000,Z=34.000000)
     DownwardBias=16.000000
     DrawType=DT_StaticMesh
     StaticMesh=StaticMesh'WeaponStaticMesh.Shield'
     bHidden=True
     bReplicateInstigator=True
     Physics=PHYS_Trailer
     RemoteRole=ROLE_SimulatedProxy
     DrawScale=3.200000
     Skins(0)=FinalBlend'XEffectMat.Shield.Shield3rdFB'
     Skins(1)=FinalBlend'XEffectMat.Shield.ShieldRip3rdFB'
     AmbientGlow=250
     bUnlit=True
     bOwnerNoSee=True
     bNetNotify=True
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Tue 24/10/2006 17:08:00.000 - Creation time: Wed 7/2/2007 19:16:51.250 - Created with UnCodeX