UMSAudio
Class UMSAudio

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

class UMSAudio
extends UMS1_6.UMSModule



Source Code


00001	class UMSAudio expands UMSModule;
00002	
00003	function bool runCommand(string Script[20])
00004	{
00005	    switch(Script[0])    
00006	    {
00007	        case "SoundEffect":
00008	            ExecuteSoundEffect(Script);
00009	            return true;
00010	            break;
00011	        case "PlaySong":
00012	            ExecutePlaySong(Script);
00013	            return true;
00014	            break;
00015	    }
00016	
00017		return false;
00018	}
00019	
00020	
00021	//*******************************************************************
00022	//SoundEffects Stuff
00023	//*******************************************************************
00024	
00025	function ExecuteSoundEffect(string Script[20])
00026	{
00027	    local PlayerPawn M;
00028	    local sound MySound;
00029	    local float Volume;
00030	
00031	    MySound = Sound(DynamicLoadObject(Script[1], class'Sound'));
00032	    Volume = currentScriptVal;
00033	    
00034	    foreach AllActors(class 'PlayerPawn', M)
00035	    {
00036	        M.PlayOwnedSound(MySound,,Volume);
00037	    }
00038	}
00039	
00040	
00041	//*******************************************************************
00042	//PlaySong Stuff
00043	//*******************************************************************
00044	
00045	function ExecutePlaySong(string Script[20])
00046	{
00047	    local PlayerPawn M;
00048	    local Music Song;
00049	    local float SongSection, TransitionNum;
00050	    local EMusicTransition Transition;
00051	
00052	    Song = Music(DynamicLoadObject(Script[1], class'Music'));
00053	    SongSection = currentScriptVal;
00054	    //Once again I am using a value that really doesn't make sense, 
00055	    //but I do it only because it is the easiest way to do things 
00056	    //both from my standpoint and yours.  There are six possible
00057	    //music transitions.  Set one of the values of ScriptVectors to
00058	    //a number 0 through 5 (X, Y, or Z, it doesn't matter, but only
00059	    //one of them).  This will correspond with one of the six kinds
00060	    //of transitions.  If you don't care about transitions, don't do
00061	    //anything.
00062	    TransitionNum = VSize(currentScriptVector);
00063	
00064	    switch (TransitionNum)
00065	    {
00066	        case 0:
00067	            Transition = MTRAN_Instant;
00068	            break;
00069	        case 1:
00070	            Transition = MTRAN_Segue;
00071	            break;
00072	        case 2:
00073	            Transition = MTRAN_Fade;
00074	            break;
00075	        case 3:
00076	            Transition = MTRAN_FastFade;
00077	            break;
00078	        case 4:
00079	            Transition = MTRAN_SlowFade;
00080	            break;
00081	        caseelse:
00082	            Transition = MTRAN_None;        
00083	            break;
00084	    }
00085	    
00086	    foreach AllActors(class 'PlayerPawn', M)
00087	    {
00088	        M.ClientSetMusic(Song, SongSection, 255, Transition);
00089	    }
00090	}
00091	
00092	defaultproperties
00093	{
00094	}

End Source Code