UnrealShare
Class AssertMover

source: e:\games\UnrealTournament\UnrealShare\Classes\AssertMover.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Brush
         |
         +--Engine.Mover
            |
            +--UnrealShare.AssertMover
Direct Known Subclasses:None

class AssertMover
extends Engine.Mover

//============================================================================= // AssertMover. //=============================================================================
Variables
 float CloseTimes[6]
 int LastKeyNum
 float WaitUnAssertTime
 OpenTimes [6]
 bool bOnceOnlyStopOpen


Function Summary
 void BeginPlay()
 void BeginState()
 void DoClose()
 void DoOpen()
 bool HandleDoor(Pawn Other)
     
// When triggered, open, wait, then close.
//
 void InterpolateEnd(Actor Other)
 void Trigger(Actor Other, Pawn EventInstigator)
 void UnTrigger(Actor Other, Pawn EventInstigator)



Source Code


00001	//=============================================================================
00002	// AssertMover.
00003	//=============================================================================
00004	class AssertMover extends Mover;
00005	
00006	// A mover which keeps opening as long as the instigator stays within
00007	// the trigger's radius.  If the instigator steps out, the mover will
00008	// stay in it's current position for WaitUnAssertTime time, and then
00009	// close all the way back to the beginning.  If the bTriggerOnceOnly
00010	// variable is true, once it reaches the last keyframe, it will
00011	// stay there forever if bOnceOnlyStopOpen is true, or it will go back
00012	// to the first frame (after waiting for StayOpenTime) and stay there 
00013	// forever if bOnceOnlyStopOpen is false.  If bTriggerOnceOnly is 
00014	// false, when it reaches the last keyframe, after it waits for 
00015	// StayOpenTime, it will return to the first keyframe, and the
00016	// entire process will be repeatable.
00017	// Note: When the last keyframe is reached, Event will be called. M.
00018	
00019	
00020	var() float OpenTimes [6];
00021	var() float CloseTimes[6];
00022	var() bool  bOnceOnlyStopOpen;
00023	var() float WaitUnAssertTime;
00024	
00025	var int LastKeyNum;
00026	
00027	function BeginPlay() 
00028	{
00029	
00030		KeyNum = 0;
00031		Super.BeginPlay();
00032	}
00033	
00034	
00035	function DoOpen() 
00036	{
00037	
00038		// Open through to the next keyframe.
00039		//
00040		bOpening = true;
00041		bDelaying = false;
00042		LastKeyNum = KeyNum;
00043		InterpolateTo (KeyNum+1, OpenTimes[Keynum]);
00044		PlaySound (OpeningSound);
00045		AmbientSound = MoveAmbientSound;
00046	}
00047	
00048	function DoClose() 
00049	{
00050	
00051		// Close through to the next keyframe.
00052		//
00053		bOpening = false;
00054		bDelaying = false;
00055		LastKeyNum = KeyNum;
00056		InterpolateTo (KeyNum-1, CloseTimes[Keynum-1]);
00057		PlaySound (ClosingSound);
00058		AmbientSound = MoveAmbientSound;
00059	}
00060	
00061	//=======================================================================
00062	// The various states
00063	
00064	// When triggered, open, wait, then close.
00065	//
00066	state() AssertTriggerOpenTimed 
00067	{
00068		function bool HandleDoor(pawn Other)
00069		{
00070			return HandleTriggerDoor(Other);
00071		}
00072	
00073		function Trigger( actor Other, pawn EventInstigator )
00074		{
00075			// Keep opening until untriggered
00076			SavedTrigger = Other;
00077			Instigator = EventInstigator;
00078			if ( SavedTrigger != None )
00079				SavedTrigger.BeginEvent();
00080			GotoState( 'AssertTriggerOpenTimed', 'Open' );
00081		}
00082	
00083		function UnTrigger( actor Other, pawn EventInstigator )
00084		{
00085			// Start waiting, and close when the waiting time has expired
00086			// (unless re-triggered within the waiting interval,
00087			//  when it will keep opening).
00088			SavedTrigger = Other;
00089			Instigator = EventInstigator;
00090			GotoState( 'AssertTriggerOpenTimed', 'WaitClose' );	
00091		}
00092	
00093		function InterpolateEnd(actor Other) 
00094		{	
00095		}
00096	
00097		function BeginState()
00098		{
00099			bOpening = false;
00100		}
00101			
00102	Open:
00103	
00104		Disable( 'Trigger' );
00105		if ( DelayTime > 0 )
00106		{
00107			bDelaying = true;
00108			Sleep(DelayTime);
00109		}
00110		if( KeyNum+1 >= NumKeys )
00111		{
00112			if( bTriggerOnceOnly && bOnceOnlyStopOpen ) GotoState('');
00113	
00114			// Wait in the open position for some time
00115			Disable( 'UnTrigger' );
00116			Sleep( StayOpenTime );
00117			GotoState( 'AssertTriggerOpenTimed', 'CloseFully' );
00118		}
00119		DoOpen();
00120		FinishInterpolation();
00121		FinishedOpening();
00122	
00123		// Loop forever
00124		GotoState( 'AssertTriggerOpenTimed', 'Open' );
00125	
00126	WaitClose:
00127		Disable( 'UnTrigger' );
00128		FinishInterpolation();
00129		FinishedOpening();
00130		
00131		// Wait a little while in this current position, before closing
00132		Sleep( WaitUnAssertTime );
00133		
00134	CloseFully:
00135		DoClose();
00136		FinishInterpolation();
00137		FinishedClosing();
00138		
00139		if( KeyNum > 0 ) GotoState( 'AssertTriggerOpenTimed', 'CloseFully' );
00140	
00141		if( bTriggerOnceOnly ) GotoState('');
00142	
00143		// Set it back to its initial state
00144		Enable('Trigger');
00145		Enable('UnTrigger');	
00146		Stop;
00147	}
00148	
00149	defaultproperties
00150	{
00151	}

End Source Code