Core.Object | +--Engine.Actor | +--Engine.Brush | +--Engine.Mover | +--UnrealI.ElevatorMover
int
LastKeyNum
MoveDirection
float
MoveTimeInterval
NextKeyNum
bool
bMoveKey
void
BeginPlay()
BeginState()
DoClose()
DoOpen()
InterpolateEnd(Actor Other)
MoveKeyframe(int newKeyNum, float newMoveTime)
00001 //============================================================================= 00002 // ElevatorMover. 00003 //============================================================================= 00004 class ElevatorMover extends Mover; 00005 00006 // Allows this mover to go from any key frame to any other key frame, 00007 // depending on the trigger settings. This produces elevator-like control. M 00008 00009 var int LastKeyNum; 00010 var int NextKeyNum; 00011 var int MoveDirection; 00012 var float MoveTimeInterval; 00013 var bool bMoveKey; 00014 00015 function BeginPlay() 00016 { 00017 Super.BeginPlay(); 00018 bMoveKey = true; 00019 } 00020 00021 function MoveKeyframe( int newKeyNum, float newMoveTime ) 00022 { 00023 if( !bMoveKey ) return; 00024 00025 NextKeyNum = newKeyNum; 00026 if( NextKeyNum < KeyNum ) 00027 { 00028 MoveDirection = -1; 00029 MoveTimeInterval = newMoveTime/(KeyNum-NextKeyNum); 00030 GotoState('ElevatorTriggerGradual','ChangeFrame'); 00031 } 00032 00033 if( NextKeyNum > KeyNum ) 00034 { 00035 MoveDirection = 1; 00036 MoveTimeInterval = newMoveTime/(NextKeyNum-KeyNum); 00037 GotoState('ElevatorTriggerGradual','ChangeFrame'); 00038 } 00039 } 00040 00041 function DoOpen() 00042 { 00043 // Open through to the next keyframe. 00044 // 00045 bOpening = true; 00046 bDelaying = false; 00047 LastKeyNum = KeyNum; 00048 InterpolateTo (KeyNum+1, MoveTime); 00049 PlaySound (OpeningSound); 00050 AmbientSound = MoveAmbientSound; 00051 } 00052 00053 function DoClose() { 00054 00055 // Close through to the next keyframe. 00056 // 00057 bOpening = false; 00058 bDelaying = false; 00059 LastKeyNum = KeyNum; 00060 InterpolateTo (KeyNum-1, MoveTime); 00061 PlaySound (ClosingSound); 00062 AmbientSound = MoveAmbientSound; 00063 } 00064 00065 00066 state() ElevatorTriggerGradual 00067 { 00068 00069 function InterpolateEnd(actor Other) 00070 { 00071 } 00072 00073 function BeginState() 00074 { 00075 bOpening = false; 00076 } 00077 00078 ChangeFrame: 00079 bMoveKey = false; 00080 00081 // Move the mover 00082 // 00083 if( MoveDirection > 0 ){ 00084 DoOpen(); 00085 FinishInterpolation(); 00086 FinishedClosing(); 00087 } 00088 else { 00089 DoClose(); 00090 FinishInterpolation(); 00091 FinishedOpening(); 00092 } 00093 00094 // Check if there are more frames to go 00095 // 00096 if( KeyNum != NextKeyNum ) 00097 { 00098 GotoState('ElevatorTriggerGradual','ChangeFrame'); 00099 } 00100 00101 bMoveKey = true; 00102 Stop; 00103 } 00104 00105 defaultproperties 00106 { 00107 }