UMSAudio
Class MovieSound

source: e:\games\UnrealTournament\UMSAudio\Classes\MovieSound.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Triggers
         |
         +--UMS1_6.UMSTriggers
            |
            +--UMSAudio.MovieSound
Direct Known Subclasses:None

class MovieSound
extends UMS1_6.UMSTriggers

//============================================================================= // MovieSound: Will play a sound that follows a specific pawn, denoted by Pawn // and MoviePawn //=============================================================================
Variables
 float ElapsedSoundLength
 string Pawn
 Pawn PawnName
 float Radius
 sound Sound
 float SoundLength
 float Volume
 bool bMoviePawn
 bool bMovieSound
 bool bPlayingMovieSound


Function Summary
 Pawn FindPawn(string PawnName)
 void PostBeginPlay()
 void Tick(float DeltaTime)
 void Trigger(Actor Other, Pawn EventInstigator)
     
//-----------------------------------------------------------------------------
// Functions.



Source Code


00001	//=============================================================================
00002	// MovieSound: Will play a sound that follows a specific pawn, denoted by Pawn
00003	// and MoviePawn
00004	//=============================================================================
00005	class MovieSound extends UMSTriggers;
00006	
00007	//-----------------------------------------------------------------------------
00008	// Variables.
00009	
00010	var bool bMovieSound;
00011	var bool bMoviePawn;
00012	var Pawn PawnName;
00013	var bool bPlayingMovieSound;
00014	var float ElapsedSoundLength;
00015	var() float Volume;
00016	var() sound Sound;
00017	var() string Pawn;
00018	var() float Radius;
00019	var float SoundLength;
00020	
00021	//-----------------------------------------------------------------------------
00022	// Functions.
00023	
00024	function Trigger( actor Other, pawn EventInstigator )
00025	{
00026	    PlaySound(Sound,,Volume,,Radius);
00027	    bPlayingMovieSound=true;
00028	    ElapsedSoundLength=0;
00029	}
00030	
00031	function PostBeginPlay()
00032	{
00033	    PawnName = FindPawn(Pawn);
00034	    if(PawnName!=NONE)
00035	    {
00036	        bMoviePawn=true;
00037	    }
00038	    SoundLength=GetSoundDuration(Sound);
00039	}
00040	
00041	function Pawn FindPawn(string PawnName)
00042	{
00043	    local Pawn P;
00044	
00045	    foreach AllActors(class'Pawn', P)
00046	        if (PawnName ~= string(P.Tag) || PawnName ~= string(P.Name))
00047	               return P;
00048	    //If there is no matching pawn, return none.
00049	    return NONE;
00050	}
00051	
00052	function Tick(float DeltaTime)
00053	{
00054	    if (bPlayingMovieSound == true && bMoviePawn == true)
00055	    {
00056	        SetLocation(PawnName.Location);
00057	        ElapsedSoundLength+=DeltaTime;
00058	        if (ElapsedSoundLength >= SoundLength)
00059	        {
00060	            bPlayingMovieSound=false;
00061	        }
00062	    }
00063	}
00064	
00065	defaultproperties
00066	{
00067	     Volume=255.000000
00068	     Radius=400.000000
00069	     Texture=Texture'Engine.S_SpecialEvent'
00070	}

End Source Code