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

UT2k4AssaultFull.WA_SpaceFighter


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
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
//=============================================================================
// WA_SpaceFighter
//=============================================================================
// Created by Laurent Delayen
// © 2003, Epic Games, Inc.  All Rights Reserved
//=============================================================================

class WA_SpaceFighter extends xWeaponAttachment;


var FX_SpaceFighter_3rdpMuzzle  MuzFlash[2];
var float                       MuzzleScale;
var bool                        bSwitch;

var class<FX_SpaceFighter_3rdpMuzzle>       MuzzleFlashClass;

var byte    OldSpawnHitCount;
var vector  mOldHitLocation;
var float   LastFireTime;


simulated function Destroyed()
{
    if ( MuzFlash[0] != None )
        MuzFlash[0].Destroy();

    if ( MuzFlash[1] != None )
        MuzFlash[1].Destroy();

    super.Destroyed();
}

/* UpdateHit
- used to update properties so hit effect can be spawn client side
*/
function UpdateHit(Actor HitActor, vector HitLocation, vector HitNormal)
{
    SpawnHitCount++;
    mHitLocation    = HitLocation;
    mHitActor       = HitActor;
    mHitNormal      = HitNormal;
}


simulated event ThirdPersonEffects()
{
    bSwitch = ( (FlashCount % 2) == 1 );

    if ( Level.NetMode != NM_DedicatedServer && Instigator != None && FlashCount > 0 )
    {
        if ( FiringMode == 0 )
        {
            if ( bSwitch )
                MuzzleFlashEffect( 0, 1 );      // Right Muzzle
            else
                MuzzleFlashEffect( 1,-1 );      // Left Muzzle
        }

        // have pawn play firing anim
        if ( Instigator != None && FiringMode == 0 && FlashCount > 0 )
        {
            if ( bSwitch )
                Instigator.PlayFiring(1.0, '1');
            else
                Instigator.PlayFiring(1.0, '0');
        }
    }

    super.ThirdPersonEffects();
}


simulated function MuzzleFlashEffect( int number, float fSide )
{
    local vector                    Start;

    Start = GetFireStart( fSide );

    if ( MuzFlash[number] == None )
    {
        // Spawn Team colored Muzzle Flash effect
        MuzFlash[number] = Spawn(MuzzleFlashClass,,, Start, Instigator.Rotation);

        if ( MuzFlash[number] != None )
        {
            MuzFlash[number].SetScale( MuzzleScale );
            MuzFlash[number].SetBase( Instigator );

            if ( Instigator.GetTeamNum() == 0 ) // Red color version
                MuzFlash[number].SetRedColor();
        }
    }
    else
    {
        // Revive dead particles...
        MuzFlash[number].Emitters[0].SpawnParticle( 3 );
    }

    PlayFireFX( fSide );
}


simulated function PlayFireFX( float fSide )
{
    local vector                    Start, HL, HN;
    local FX_PlasmaImpact           FX_Impact;
    local Actor                     HitActor;

    if ( Instigator != None && ASVehicle_SpaceFighter(Instigator) != None )
    {
        Start = GetFireStart( fSide );
        HitActor = ASVehicle_SpaceFighter(Instigator).CalcWeaponFire( HL, HN );
        Spawn(class'UT2k4AssaultFull.FX_SpaceFighter_InstantHitLaser', Instigator, , Start, Rotator(HL - Start) );
    }

    // Impact effect
    if ( OldSpawnHitCount != SpawnHitCount )
    {
        OldSpawnHitCount = SpawnHitCount;
        GetHitInfo();
        
        if ( EffectIsRelevant(mHitLocation, false) && mHitNormal != vect(0,0,0) )
        {
            FX_Impact = Spawn(class'FX_PlasmaImpact',,, mHitLocation + mHitNormal * 2, rotator(mHitNormal));

            if ( Instigator != None && Instigator.GetTeamNum() == 0 )
                FX_Impact.SetRedColor();

            FX_Impact.PlaySound(Sound'WeaponSounds.BioRifle.BioRifleGoo2');
            
            if ( mHitActor != None && mHitActor.IsA('Pawn') )
            {
                FX_Impact.SetScale( 2.5 );
                FX_Impact.SetBase( mHitActor );
            }
            else
                FX_Impact.SetScale( 1.5 );
        }
    }
}


simulated function vector GetFireStart( float fSide )
{
    local vector    X, Y, Z, MuzzleSpawnOffset;

    if ( Instigator != None && ASVehicle(Instigator) != None )
        MuzzleSpawnOffset = ASVehicle(Instigator).VehicleProjSpawnOffset;

    GetAxes( Instigator.Rotation, X, Y, Z );
    return Instigator.Location + X*MuzzleSpawnOffset.X + fSide*Y*MuzzleSpawnOffset.Y + Z*MuzzleSpawnOffset.Z;
}


//=============================================================================
// defaultproperties
//=============================================================================

defaultproperties
{
     MuzzleScale=1.000000
     MuzzleFlashClass=Class'UT2k4Assault.FX_SpaceFighter_3rdpMuzzle'
     bRapidFire=True
     bAltRapidFire=True
     bHidden=True
     Mesh=SkeletalMesh'Weapons.LinkGun_3rd'
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Mon 23/10/2006 20:40:04.000 - Creation time: Wed 7/2/2007 19:16:58.703 - Created with UnCodeX