Core.Object | +--Engine.Actor | +--UMS1_6.UMS | +--UMSPawn.MovieSkinChanger
int
CurrentCommand
Pawn
MyPawn
Texture
MySkins[80]
string
PawnName
SkinScript[50]
SkinTargets[50]
float
WaitTime
WaitTimes[50]
bool
bRolling
void
ExecuteNextCommand()
//Grab the next command from the SkinScript and execute it.
MoviePawn
FindPawn(string PawnName)
GoBackToMyTrailer()
//Destroys the MovieSkinChanger - used for cleaning up level.
SetSkin()
00001 //============================================================================= 00002 // MovieSkinChanger. 00003 //============================================================================= 00004 class MovieSkinChanger expands UMS; 00005 00006 var() string PawnName; 00007 var pawn MyPawn; 00008 var() int SkinScript[50]; 00009 var() int SkinTargets[50]; 00010 var() float WaitTimes[50]; 00011 var() texture MySkins[80]; 00012 var bool bRolling; 00013 var int CurrentCommand; 00014 var float WaitTime; 00015 00016 //MovieSkinChanger will start using the SkinScript if triggered. 00017 event Trigger( Actor other, Pawn instigator ) 00018 { 00019 MyPawn = FindPawn(PawnName); 00020 bRolling = true; 00021 } 00022 00023 //Grab the next command from the SkinScript and execute it. 00024 function ExecuteNextCommand() 00025 { 00026 SetSkin(); 00027 00028 //Now wait the appropriate amount of time before doing the next 00029 //command. 00030 WaitTime = WaitTimes[CurrentCommand]; 00031 GotoState('Waiting'); 00032 00033 CurrentCommand++; 00034 00035 if(CurrentCommand > 50) 00036 GoBackToMyTrailer(); 00037 } 00038 00039 //Destroys the MovieSkinChanger - used for cleaning up level. 00040 function GoBackToMyTrailer() 00041 { 00042 Destroy(); 00043 } 00044 00045 //State used to wait. 00046 auto state Waiting 00047 { 00048 Begin: 00049 StartWaiting: 00050 Sleep(WaitTime); 00051 GotoState('Rolling'); 00052 } 00053 00054 //State used to execute commands. 00055 state Rolling 00056 { 00057 Begin: 00058 if(!bRolling) 00059 GotoState('Waiting'); 00060 ExecuteCommand: 00061 if(bRolling) 00062 ExecuteNextCommand(); 00063 CheckForWait: 00064 Goto'Begin'; 00065 } 00066 00067 function SetSkin() 00068 { 00069 local int ElementNum, DesiredSkin; 00070 00071 ElementNum = SkinTargets[CurrentCommand]; 00072 DesiredSkin = SkinScript[CurrentCommand]; 00073 00074 //Negative SkinScript or ElementNum means to destroy this MovieSkinChanger 00075 if(DesiredSkin < 0 || ElementNum < 0) 00076 { 00077 GoBackToMyTrailer(); 00078 return; 00079 } 00080 00081 if(ElementNum >= 0 && ElementNum <= 7) 00082 MyPawn.MultiSkins[ElementNum] = MySkins[DesiredSkin]; 00083 else 00084 MyPawn.Skin = MySkins[DesiredSkin]; 00085 } 00086 00087 function MoviePawn FindPawn(string PawnName) 00088 { 00089 local MoviePawn P; 00090 00091 foreach AllActors(class'MoviePawn', P) 00092 if (PawnName ~= string(P.Tag )) 00093 return P; 00094 //If there is no matching pawn, return none. 00095 return NONE; 00096 } 00097 00098 defaultproperties 00099 { 00100 }