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

UT2k4Assault.ACTION_PlayExplosionSound


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
//=============================================================================
// ACTION_PlayExplosionSound
//=============================================================================
// Standardize explosion sounds...
// Various explosion sounds are combined to create a unique and loud sound
//=============================================================================
// Created by Laurent Delayen
// © 2004, Epic Games, Inc.  All Rights Reserved
//=============================================================================

class ACTION_PlayExplosionSound extends LatentScriptedAction;

var(Action) name    SoundEmitterActorTag;   // source emitting the sound (none = self)
var(Action) float   SoundVolumeScale;       // volume scale
var(Action) float   SoundRadiusScale;       // radius scale
var(Action) float   SoundPitchScale;        // pitch scale

var Actor   SoundEmitter;
var Sound   ExplosionSound[11];
var byte    bPlayed[11];

event PostBeginPlay( ScriptedSequence SS )
{
    super.PostBeginPlay( SS );
    if ( SoundEmitterActorTag == 'None' || SoundEmitterActorTag == '' )
        SoundEmitter = SS;
    else
        ForEach SS.AllActors(class'Actor', SoundEmitter, SoundEmitterActorTag)
            break;
}

function bool InitActionFor(ScriptedController C)
{
    if ( SoundEmitter != None )
    {
        PlayUniqueRandomExplosion();
        PlayUniqueRandomExplosion();
        
        C.CurrentAction = self;
        C.SetTimer(0.33, false);
        return true;
    }
    return false;
}

event ActionCompleted()
{
    PlayUniqueRandomExplosion();
}

function bool CompleteWhenTriggered()
{
    return true;
}

function bool CompleteWhenTimer()
{
    return true;
}

function string GetActionString()
{
    return ActionString @ SoundEmitterActorTag;
}

function PlayUniqueRandomExplosion()
{
    local int Num;
    
    Num = Rand(42) % 11;
    if ( bPlayed[Num] > 0 ) 
    {   
        PlayUniqueRandomExplosion(); // try again if already played this sound...
        return;
    }

    SoundEmitter.PlaySound(ExplosionSound[Num],, 4.0*SoundVolumeScale,, 1600*SoundRadiusScale, SoundPitchScale);
    bPlayed[Num] = 1;
}

event Reset()
{
    local int i;

    super.Reset();
    for (i=0; i<11; i++)
        bPlayed[i] = 0;
}

defaultproperties
{
     SoundVolumeScale=1.000000
     SoundRadiusScale=1.000000
     SoundPitchScale=1.000000
     ExplosionSound(0)=Sound'ONSVehicleSounds-S.Explosions.Explosion01'
     ExplosionSound(1)=Sound'ONSVehicleSounds-S.Explosions.Explosion02'
     ExplosionSound(2)=Sound'ONSVehicleSounds-S.Explosions.Explosion03'
     ExplosionSound(3)=Sound'ONSVehicleSounds-S.Explosions.Explosion04'
     ExplosionSound(4)=Sound'ONSVehicleSounds-S.Explosions.Explosion05'
     ExplosionSound(5)=Sound'ONSVehicleSounds-S.Explosions.Explosion06'
     ExplosionSound(6)=Sound'ONSVehicleSounds-S.Explosions.Explosion07'
     ExplosionSound(7)=Sound'ONSVehicleSounds-S.Explosions.Explosion08'
     ExplosionSound(8)=Sound'ONSVehicleSounds-S.Explosions.Explosion09'
     ExplosionSound(9)=Sound'ONSVehicleSounds-S.Explosions.Explosion10'
     ExplosionSound(10)=Sound'ONSVehicleSounds-S.Explosions.Explosion11'
     ActionString="Play explosion sound"
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Fr 30.3.2007 08:43:52.000 - Creation time: Mo 16.4.2007 11:20:43.937 - Created with UnCodeX