## XIDCine
Class LiftManager

source: C:\XIII\XIDCine\Classes\LiftManager.uc

    Core.Object
       |
       +--Engine.Actor
          |
          +--Engine.Info
             |
             +--XIDCine.LiftManager

Direct Known Subclasses:None

class LiftManager
extends Engine.Info

Variables
`int` | `CurrentFloor`
`bool` | `CurrentFloorDoorsOpen`
`LiftButton` | `Floor1_CallingButton`
`LiftDoor` | `Floor1_OuterDoors[2]`
`LiftButton` | `Floor2_CallingButton`
`LiftDoor` | `Floor2_OuterDoors[2]`
`LiftButton` | `Internal_Button`
`LiftDoor` | `Internal_Doors[2]`
`LiftCage` | `LiftCage`
`name` | `MemoState`
`vector` | `RL_Doors[2]`
`float` | `Z_CloseDelayExternalDoor`
`float` | `Z_CloseDelayInternalDoor`
`float` | `Z_OpenDelayExternalDoor`
`float` | `Z_OpenDelayInternalDoor`
`float` | `Z_TimeExternalDoors`
`float` | `Z_TimeInternalDoors`
`float` | `Z_TimeLiftCage`

States
OpenInternalAndSecondFloorDoors, GotoFloor2, CloseInternalAndFirstFloorDoors, OpenInternalAndFirstFloorDoors, GotoFloor1, CloseInternalAndSecondFloorDoors, CallFloor2, CallFloor1

Function Summary
`void` | `WaitingForAllDoorsAreClose()`
    /*

State OpenInternalAndSecondFloorDoors Function Summary

State GotoFloor2 Function Summary

State CloseInternalAndFirstFloorDoors Function Summary

State OpenInternalAndFirstFloorDoors Function Summary

State GotoFloor1 Function Summary

State CloseInternalAndSecondFloorDoors Function Summary

State CallFloor2 Function Summary
`void` | `BeginState()`

State CallFloor1 Function Summary
`void` | `BeginState()`

Source Code

    00001	class LiftManager extends info
    00002		hidecategories(display,sound,rolloff)
    00003		placeable;
    00004
    00005	VAR() LiftDoor Floor1_OuterDoors[2];
    00006	VAR() LiftDoor Floor2_OuterDoors[2];
    00007	VAR() LiftDoor Internal_Doors[2];
    00008	VAR() LiftButton Floor1_CallingButton;
    00009	VAR() LiftButton Floor2_CallingButton;
    00010	VAR() LiftButton Internal_Button;
    00011	VAR() LiftCage LiftCage;
    00012	VAR() int CurrentFloor;
    00013	VAR() bool CurrentFloorDoorsOpen;
    00014	VAR() float Z_TimeLiftCage;
    00015	VAR() float Z_TimeInternalDoors;
    00016	VAR() float Z_TimeExternalDoors;
    00017	VAR() float Z_OpenDelayInternalDoor;
    00018	VAR() float Z_OpenDelayExternalDoor;
    00019	VAR() float Z_CloseDelayInternalDoor;
    00020	VAR() float Z_CloseDelayExternalDoor;
    00021	VAR(Advanced) bool bAutomatic;
    00022
    00023	VAR vector RL_Doors[2];
    00024	VAR name MemoState;
    00025
    00026	// Pour le debug
    00027	//VAR XIIIPlayerController PC;
    00028
    00029	EVENT PostBeginPlay( )
    00030	{
    00031		LOCAL LiftCage lc;
    00032		LOCAL LiftButton lb;
    00033		LOCAL LiftDoor ld;
    00034		LOCAL int eldIndex, ildIndex; // external and internal liftdoor indexes
    00035		LOCAL vector vCageOtherKeyRelLoc;
    00036
    00037		if ( bAutomatic )
    00038		{
    00039	//		DebugLog ("LIFT:: AUTOMATIC");
    00040	//		DebugLog ("LIFT:: Cleaning variables");
    00041
    00042			LiftCage=none;
    00043			Floor1_OuterDoors[0]=none;
    00044			Floor1_OuterDoors[1]=none;
    00045			Floor2_OuterDoors[0]=none;
    00046			Floor2_OuterDoors[1]=none;
    00047			Internal_Doors[0]=none;
    00048			Internal_Doors[1]=none;
    00049			Floor1_CallingButton=none;
    00050			Floor2_CallingButton=none;
    00051			Internal_Button=none;
    00052			CurrentFloor=1;
    00053			CurrentFloorDoorsOpen=true;
    00054
    00055			// cherche une cage d'ascenseur à moins de 5 mètres (position du pivot)
    00056			foreach RadiusActors(class 'LiftCage', lc, 400)
    00057			{
    00058				break;
    00059			}
    00060			if ( lc == none )
    00061			{
    00062	//			log ("LIFT:: No lift cage"@name);
    00063				Destroy();
    00064			}
    00065			LiftCage=lc;
    00066			LiftCage.MoveTime=Z_TimeLiftCage;
    00067			if (LiftCage.KeyNum==0)
    00068				vCageOtherKeyRelLoc=LiftCage.KeyPos[1];
    00069			else
    00070				vCageOtherKeyRelLoc=-LiftCage.KeyPos[1];
    00071
    00072	// cherche des boutons d'ascenseur à moins de 4 mètres
    00073			foreach RadiusActors(class 'LiftButton', lb, 300)
    00074			{
    00075				if ( (lb.Location-Location) dot vector(rotation) > 0 )
    00076				{
    00077					// Internal
    00078					if ( Internal_Button==none )
    00079					{
    00080						lb.SetBase( LiftCage );
    00081						lb.Event=Tag;
    00082	//					DebugLog ("LIFT:: Register Internal_Button"@lb);
    00083						Internal_Button=lb;
    00084					}
    00085	//				else
    00086	//					Log ("LIFT:: Too many internal liftbutton in lift"@name);
    00087				}
    00088				else
    00089				{
    00090					// External
    00091					if ( Floor1_CallingButton==none )
    00092					{
    00093						Floor1_CallingButton=lb;
    00094						Floor1_CallingButton.Event=Tag;
    00095						DebugLog ("LIFT:: Register 1st floor calling button"@lb);
    00096					}
    00097	//				else
    00098	//					log ("LIFT:: Too many 1st floor calling button in lift"@name);
    00099				}
    00100			}
    00101
    00102			foreach RadiusActors(class 'LiftButton', lb, 300, Location + vCageOtherKeyRelLoc)
    00103			{
    00104				if ( Floor2_CallingButton==none )
    00105				{
    00106					Floor2_CallingButton=lb;
    00107					Floor2_CallingButton.Event=Tag;
    00108	//				DebugLog ("LIFT:: Register 2nd floor calling button"@lb);
    00109				}
    00110	//			else
    00111	//				log ("LIFT:: Too many 2nd floor calling button in lift"@name);
    00112			}
    00113
    00114	// cherche des portes d'ascenseur à moins de 4 mètres
    00115			foreach RadiusActors(class 'LiftDoor', ld, 300)
    00116			{
    00117				if ( (ld.Location-Location) dot vector(rotation) > 0 )
    00118				{
    00119					// Internal
    00120					if ( ildIndex<2 )
    00121					{
    00122						Internal_Doors[ildIndex]=ld;
    00123	//					DebugLog ("LIFT:: Register internal liftdoor"@ld);
    00124						RL_Doors[ildIndex]=ld.BasePos-LiftCage.Location;
    00125						ld.SetBase( LiftCage );
    00126						ld.MoveTime=Z_TimeInternalDoors;
    00127						if (ld.KeyNum==0)
    00128							CurrentFloorDoorsOpen=false;
    00129
    00130						ildIndex++;
    00131					}
    00132	//				else
    00133	//					log ("LIFT:: Too many internal liftdoor in lift"@name);
    00134
    00135				}
    00136				else
    00137				{
    00138					// External
    00139					if ( eldIndex<2 )
    00140					{
    00141						Floor1_OuterDoors[eldIndex]=ld;
    00142						ld.MoveTime=Z_TimeExternalDoors;
    00143	//					DebugLog ("LIFT:: Register 1st floor external doors"@ld);
    00144						if (ld.KeyNum==0)
    00145							CurrentFloorDoorsOpen=false;
    00146						eldIndex++;
    00147					}
    00148	//				else
    00149	//					log ("LIFT:: Too many 1st floor external doors in lift"@name);
    00150				}
    00151			}
    00152			eldIndex=0;
    00153			foreach RadiusActors(class 'LiftDoor', ld, 300, Location + vCageOtherKeyRelLoc )
    00154			{
    00155				if ( eldIndex<2 )
    00156				{
    00157					Floor2_OuterDoors[eldIndex]=ld;
    00158					ld.MoveTime=Z_TimeExternalDoors;
    00159	//				DebugLog ("LIFT:: Register 2nd floor external doors"@ld);
    00160					eldIndex++;
    00161				}
    00162	//			else
    00163	//				log ("LIFT:: Too many 1st floor external doors in lift"@name);
    00164			}
    00165			CurrentFloor=1;
    00166		}
    00167		else
    00168		{
    00169			LiftCage.MoveTime=Z_TimeLiftCage;
    00170
    00171			if ( Internal_Doors[0]!=none )
    00172			{
    00173				RL_Doors[0]=Internal_Doors[0].BasePos-LiftCage.Location;
    00174				Internal_Doors[0].SetBase( LiftCage );
    00175				Internal_Doors[0].MoveTime=Z_TimeInternalDoors;
    00176			}
    00177			if ( Internal_Doors[1]!=none )
    00178			{
    00179				RL_Doors[1]=Internal_Doors[1].BasePos-LiftCage.Location;
    00180				Internal_Doors[1].SetBase( LiftCage );
    00181				Internal_Doors[1].MoveTime=Z_TimeInternalDoors;
    00182			}
    00183			if ( Floor1_OuterDoors[0]!=none )
    00184			{
    00185				Floor1_OuterDoors[0].MoveTime=Z_TimeExternalDoors;
    00186			}
    00187			if ( Floor1_OuterDoors[1]!=none )
    00188			{
    00189				Floor1_OuterDoors[1].MoveTime=Z_TimeExternalDoors;
    00190			}
    00191			if ( Floor2_OuterDoors[0]!=none )
    00192			{
    00193				Floor2_OuterDoors[0].MoveTime=Z_TimeExternalDoors;
    00194			}
    00195			if ( Floor2_OuterDoors[1]!=none )
    00196			{
    00197				Floor2_OuterDoors[1].MoveTime=Z_TimeExternalDoors;
    00198			}
    00199			if ( Internal_Button!=none )
    00200			{
    00201				Internal_Button.SetBase( LiftCage );
    00202			}
    00203		}
    00204	}
    00205
    00206	EVENT Untrigger(actor Other, Pawn EventInstigator)
    00207	{
    00208		Trigger( Other, EventInstigator );
    00209	}
    00210
    00211	EVENT Trigger(actor Other, Pawn EventInstigator)
    00212	{
    00213	//	Other.tag
    00214	//	DebugLog("LM::Trigger");
    00215		if ( Other == Floor1_CallingButton )
    00216		{
    00217	//		DebugLog("LM::Global::Trigger->GotoState('CallFloor1')");
    00218			GotoState('CallFloor1');
    00219		}
    00220		else
    00221			if ( Other == Floor2_CallingButton )
    00222			{
    00223	//			DebugLog("LM::Global::Trigger->GotoState('CallFloor2')");
    00224				GotoState('CallFloor2');
    00225			}
    00226			else
    00227
if ( Other == Internal_Button ) 00228 { 00229 if ( CurrentFloor == 1 ) 00230 // { 00231 // DebugLog("LM::Global::Trigger->GotoState('CloseInternalAndFirstFloorDoors')"); 00232 GotoState('CloseInternalAndFirstFloorDoors'); 00233 // } 00234 else 00235 // { 00236 // DebugLog("LM::Global::Trigger->GotoState('CloseInternalAndSecondFloorDoors')"); 00237 GotoState('CloseInternalAndSecondFloorDoors'); 00238 // } 00239 } 00240 } 00241 00242 /* 00243 FUNCTION WaitingForAllDoorsAreClose() 00244 { 00245 MemoState = GetStateName(); 00246 GotoState('WaitDoors'); 00247 } 00248 */ 00249 STATE CallFloor1 00250 { 00251 FUNCTION BeginState() 00252 { 00253 // DebugLog("LM::Trigger->GotoState('CloseInternalAndSecondFloorDoors')"); 00254 if ( CurrentFloor!=1 ) 00255 { 00256 // Close Internal and Second Floor Doors 00257 // DebugLog("LM::CallFloor1::BeginState->GotoState('CloseInternalAndSecondFloorDoors')"); 00258 GotoState('CloseInternalAndSecondFloorDoors'); 00259 return; 00260 } 00261 else 00262 { 00263 if ( !CurrentFloorDoorsOpen ) 00264 { 00265 // DebugLog("LM::CallFloor1::BeginState->GotoState('OpenInternalAndFirstFloorDoors')"); 00266 GotoState('OpenInternalAndFirstFloorDoors'); 00267 return; 00268 } 00269 } 00270 } 00271 } 00272 00273 STATE CallFloor2 00274 { 00275 FUNCTION BeginState() 00276 { 00277 if ( CurrentFloor!=2 ) 00278 { 00279 // Close Internal and Second Floor Doors 00280 // DebugLog("LM::CallFloor2::BeginState->GotoState('CloseInternalAndFirstFloorDoors')"); 00281 GotoState('CloseInternalAndFirstFloorDoors'); 00282 return; 00283 } 00284 else 00285 { 00286 if ( !CurrentFloorDoorsOpen ) 00287 { 00288 // DebugLog("LM::CallFloor2::BeginState->GotoState('OpenInternalAndSecondFloorDoors')"); 00289 GotoState('OpenInternalAndSecondFloorDoors'); 00290 return; 00291 } 00292 } 00293 } 00294 } 00295 00296 STATE CloseInternalAndSecondFloorDoors 00297 { 00298 EVENT BeginState( ) 00299 { 00300 LOCAL float waittime; 00301 00302 LOCAL bool bMoveUp; 00303 00304 // DebugLog("LM::CloseInternalAndSecondFloorDoors::BeginState"); 00305 00306 bMoveUp= (LiftCage.KeyPos[LiftCage.KeyNum].Z<LiftCage.KeyPos[1-LiftCage.KeyNum].Z); 00307 00308 if ( Internal_Button != none ) { Internal_Button.CageIsCalled( bMoveUp ); } 00309 if ( Floor1_CallingButton != none ) { Floor1_CallingButton.CageIsCalled( bMoveUp ); } 00310 if ( Floor2_CallingButton != none ) { Floor2_CallingButton.CageIsCalled( bMoveUp ); } 00311 00312 // DebugLog( "Enter "$GetStateName() ); 00313 00314 // waittime=0; default value 00315 if ( Internal_Doors[0] != none ) 00316 { 00317 Internal_Doors[0].DelayTime = Z_CloseDelayInternalDoor; 00318 Internal_Doors[0].Untrigger( self, none ); 00319 waittime=max(waittime,Internal_Doors[0].MoveTime+Z_CloseDelayInternalDoor); 00320 } 00321 if ( Internal_Doors[1] != none ) 00322 { 00323 Internal_Doors[1].DelayTime = Z_CloseDelayInternalDoor; 00324 Internal_Doors[1].Untrigger( self, none ); 00325 waittime=max(waittime,Internal_Doors[1].MoveTime+Z_CloseDelayInternalDoor); 00326 } 00327 if ( Floor2_OuterDoors[0] != none ) 00328 { 00329 Floor2_OuterDoors[0].DelayTime = Z_CloseDelayExternalDoor; 00330 Floor2_OuterDoors[0].Untrigger( self, none ); 00331 waittime=max(waittime,Floor2_OuterDoors[0].MoveTime+Z_CloseDelayExternalDoor); 00332 } 00333 if ( Floor2_OuterDoors[1] != none ) 00334 { 00335 Floor2_OuterDoors[1].DelayTime = Z_CloseDelayExternalDoor; 00336 Floor2_OuterDoors[1].Untrigger( self, none ); 00337 waittime=max(waittime,Floor2_OuterDoors[1].MoveTime+Z_CloseDelayExternalDoor); 00338 } 00339 00340 if ( waittime != 0 ) 00341 SetTimer( waittime, false ); 00342 else 00343 Timer( ); 00344 00345 } 00346 00347 EVENT Timer( ) 00348 { 00349 CurrentFloorDoorsOpen = false; 00350 GotoState( 'GotoFloor1' ); 00351 } 00352 } 00353 00354 STATE GotoFloor1 00355 { 00356 EVENT Trigger(actor Other, Pawn EventInstigator) 00357 { 00358 } 00359 00360 EVENT BeginState( ) 00361 { 00362 LOCAL float waittime; 00363 LOCAL bool bMoveUp; 00364 00365 // DebugLog("LM::GotoFloor1::BeginState"); 00366 00367 bMoveUp= (LiftCage.KeyPos[LiftCage.KeyNum].Z<LiftCage.KeyPos[1-LiftCage.KeyNum].Z); 00368 00369 // DebugLog( "Enter "$GetStateName() ); 00370 00371 if ( LiftCage != none ) { LiftCage.Trigger( self, none ); waittime=LiftCage.MoveTime; } 00372 00373 if ( Internal_Button != none ) { Internal_Button.CageMoves( bMoveUp ); } 00374 if ( Floor1_CallingButton != none ) { Floor1_CallingButton.CageMoves( bMoveUp ); } 00375 if ( Floor2_CallingButton != none ) { Floor2_CallingButton.CageMoves( bMoveUp ); } 00376 00377 if ( waittime != 0 ) 00378 SetTimer( waittime, false ); 00379 else 00380 Timer( ); 00381 } 00382 00383 EVENT Timer( ) 00384 { 00385 LOCAL bool bMoveUp; 00386 CurrentFloor = 1; 00387 bMoveUp= (LiftCage.KeyPos[LiftCage.KeyNum].Z>LiftCage.KeyPos[1-LiftCage.KeyNum].Z); 00388 if ( Internal_Button != none ) { Internal_Button.CageIsCalled( bMoveUp ); } 00389 if ( Floor1_CallingButton != none ) { Floor1_CallingButton.CageIsCalled( bMoveUp ); } 00390 if ( Floor2_CallingButton != none ) { Floor2_CallingButton.CageIsCalled( bMoveUp ); } 00391 00392 // if ( Mover(Internal_Button) != none ) { Mover(Internal_Button).BasePos = Internal_Button.Location; } 00393 GotoState( 'OpenInternalAndFirstFloorDoors' ); 00394 } 00395 } 00396 00397 STATE OpenInternalAndFirstFloorDoors 00398 { 00399 EVENT BeginState( ) 00400 { 00401 LOCAL float waittime; 00402 00403 LOCAL bool bIsUp; 00404 bIsUp= (LiftCage.KeyPos[LiftCage.KeyNum].Z>LiftCage.KeyPos[1-LiftCage.KeyNum].Z); 00405 00406 // if ( Internal_Button != none ) { Internal_Button.CageIsCalled( bIsUp ); } 00407 if ( Floor1_CallingButton != none ) { Floor1_CallingButton.CageIsCalled( bIsUp ); } 00408 // if ( Floor2_CallingButton != none ) { Floor2_CallingButton.CageIsCalled( bIsUp ); } 00409 00410 if ( Internal_Doors[0] != none ) 00411 { 00412 Internal_Doors[0].DelayTime=Z_OpenDelayInternalDoor; 00413 Internal_Doors[0].SetLocation( LiftCage.Location + RL_Doors[0] ); 00414 Internal_Doors[0].BasePos = Internal_Doors[0].Location; 00415 Internal_Doors[0].SetBase( LiftCage ); 00416 Internal_Doors[0].Trigger( self, none ); 00417 waittime=max(waittime,Internal_Doors[0].MoveTime+Z_OpenDelayInternalDoor); 00418 } 00419 if ( Internal_Doors[1] != none ) 00420 { 00421 Internal_Doors[1].DelayTime=Z_OpenDelayInternalDoor; 00422 Internal_Doors[1].SetLocation( LiftCage.Location + RL_Doors[1] ); 00423 Internal_Doors[1].BasePos = Internal_Doors[1].Location; 00424 Internal_Doors[1].SetBase( LiftCage ); 00425 Internal_Doors[1].Trigger( self, none ); 00426 waittime=max(waittime,Internal_Doors[1].MoveTime+Z_OpenDelayInternalDoor); 00427 } 00428 if ( Floor1_OuterDoors[0] != none ) 00429 { 00430 Floor1_OuterDoors[0].DelayTime=Z_OpenDelayExternalDoor; 00431 Floor1_OuterDoors[0].Trigger( self, none ); 00432 waittime=max(waittime,Floor2_OuterDoors[0].MoveTime+Z_OpenDelayExternalDoor); 00433 } 00434 if ( Floor1_OuterDoors[1] != none ) 00435 { 00436 Floor1_OuterDoors[1].DelayTime=Z_OpenDelayExternalDoor; 00437 Floor1_OuterDoors[1].Trigger( self, none ); 00438 waittime=max(waittime,Floor2_OuterDoors[1].MoveTime+Z_OpenDelayExternalDoor); 00439 } 00440 00441 if ( waittime != 0 ) 00442 SetTimer( waittime, false ); 00443 else 00444 Timer( ); 00445 } 00446 00447 EVENT Timer( ) 00448 { 00449 if ( Internal_Button != none ) { Internal_Button.CageStops( ); } 00450 if ( Floor1_CallingButton != none ) { Floor1_CallingButton.CageStops( ); } 00451 if ( Floor2_CallingButton != none ) { Floor2_CallingButton.CageStops( ); } 00452 CurrentFloorDoorsOpen = true; 00453 GotoState( '' ); 00454 } 00455 } 00456 00457 STATE CloseInternalAndFirstFloorDoors 00458 { 00459 EVENT BeginState( ) 00460 { 00461 LOCAL float waittime; 00462 00463 LOCAL bool bMoveUp; 00464 00465 // DebugLog("LM::GotoFloor1::CloseInternalAndFirstFloorDoors"); 00466 00467 bMoveUp= (LiftCage.KeyPos[LiftCage.KeyNum].Z<LiftCage.KeyPos[1-LiftCage.KeyNum].Z); 00468 00469 if ( Internal_Button != none ) { Internal_Button.CageIsCalled( bMoveUp ); } 00470 if ( Floor1_CallingButton != none ) { Floor1_CallingButton.CageIsCalled( bMoveUp ); } 00471 if ( Floor2_CallingButton != none ) { Floor2_CallingButton.CageIsCalled( bMoveUp ); } 00472 00473 // DebugLog( "Enter "$GetStateName() ); 00474 00475 if ( Internal_Doors[0] != none ) 00476 { 00477 Internal_Doors[0].DelayTime = Z_CloseDelayInternalDoor; 00478 Internal_Doors[0].Untrigger( self, none ); 00479 waittime=max(waittime,Internal_Doors[0].MoveTime+Z_CloseDelayInternalDoor); 00480 } 00481 if ( Internal_Doors[1] != none ) 00482 { 00483 Internal_Doors[1].DelayTime = Z_CloseDelayInternalDoor; 00484 Internal_Doors[1].Untrigger( self, none ); 00485 waittime=max(waittime,Internal_Doors[1].MoveTime+Z_CloseDelayInternalDoor); 00486 } 00487 if ( Floor1_OuterDoors[0] != none ) 00488 { 00489 Floor1_OuterDoors[0].DelayTime = Z_CloseDelayExternalDoor; 00490 Floor1_OuterDoors[0].Untrigger( self, none ); 00491 waittime=max(waittime,Floor2_OuterDoors[0].MoveTime+Z_CloseDelayExternalDoor); 00492 } 00493 if ( Floor1_OuterDoors[1] != none ) 00494 { 00495 Floor1_OuterDoors[1].DelayTime = Z_CloseDelayExternalDoor; 00496 Floor1_OuterDoors[1].Untrigger( self, none ); 00497 waittime=max(waittime,Floor2_OuterDoors[1].MoveTime+Z_CloseDelayExternalDoor); 00498 } 00499 00500 if ( waittime != 0 ) 00501 SetTimer( waittime, false ); 00502 else 00503 Timer( ); 00504 00505 } 00506 00507 EVENT Timer( ) 00508 { 00509 CurrentFloorDoorsOpen = false; 00510 GotoState( 'GotoFloor2' ); 00511 } 00512 } 00513 00514 STATE GotoFloor2 00515 { 00516 EVENT Trigger(actor Other, Pawn EventInstigator) 00517 { 00518 } 00519 00520 EVENT BeginState( ) 00521 { 00522 LOCAL float waittime; 00523 LOCAL bool bMoveUp; 00524 00525 // DebugLog("LM::GotoFloor1::GotoFloor2"); 00526 00527 bMoveUp= (LiftCage.KeyPos[LiftCage.KeyNum].Z<LiftCage.KeyPos[1-LiftCage.KeyNum].Z); 00528 00529 // DebugLog( "Enter "$GetStateName() ); 00530 00531 if ( LiftCage != none ) { LiftCage.trigger( self, none ); waittime=LiftCage.MoveTime; } 00532 00533 if ( Internal_Button != none ) { Internal_Button.CageMoves( bMoveUp ); } 00534 if ( Floor1_CallingButton != none ) { Floor1_CallingButton.CageMoves( bMoveUp ); } 00535 if ( Floor2_CallingButton != none ) { Floor2_CallingButton.CageMoves( bMoveUp ); } 00536 00537 if ( waittime != 0 ) 00538 SetTimer( waittime, false ); 00539 else 00540 Timer( ); 00541 } 00542 00543 EVENT Timer( ) 00544 { 00545 LOCAL bool bMoveUp; 00546 CurrentFloor = 2; 00547 bMoveUp= (LiftCage.KeyPos[LiftCage.KeyNum].Z>LiftCage.KeyPos[1-LiftCage.KeyNum].Z); 00548 if ( Internal_Button != none ) { Internal_Button.CageIsCalled( bMoveUp ); } 00549 if ( Floor1_CallingButton != none ) { Floor1_CallingButton.CageIsCalled( bMoveUp ); } 00550 if ( Floor2_CallingButton != none ) { Floor2_CallingButton.CageIsCalled( bMoveUp ); } 00551 GotoState( 'OpenInternalAndSecondFloorDoors' ); 00552 } 00553 } 00554 00555 STATE OpenInternalAndSecondFloorDoors 00556 { 00557 EVENT BeginState( ) 00558 { 00559 LOCAL float waittime; 00560 00561 LOCAL bool bIsUp; 00562 bIsUp= (LiftCage.KeyPos[LiftCage.KeyNum].Z>LiftCage.KeyPos[1-LiftCage.KeyNum].Z); 00563 00564 // if ( Internal_Button != none ) { Internal_Button.CageIsCalled( bIsUp ); } 00565 // if ( Floor1_CallingButton != none ) { Floor1_CallingButton.CageIsCalled( bIsUp ); } 00566 if ( Floor2_CallingButton != none ) { Floor2_CallingButton.CageIsCalled( bIsUp ); } 00567 00568 if ( Internal_Doors[0] != none ) 00569 { 00570 Internal_Doors[0].DelayTime = Z_OpenDelayInternalDoor; 00571 Internal_Doors[0].SetLocation( LiftCage.Location + RL_Doors[0] ); 00572 Internal_Doors[0].BasePos = Internal_Doors[0].Location; 00573 Internal_Doors[0].SetBase( LiftCage ); 00574 Internal_Doors[0].Trigger( self, none ); 00575 waittime=max(waittime,Internal_Doors[0].MoveTime+Z_OpenDelayInternalDoor); 00576 } 00577 if ( Internal_Doors[1] != none ) 00578 { 00579 Internal_Doors[1].DelayTime = Z_OpenDelayInternalDoor; 00580 Internal_Doors[1].SetLocation( LiftCage.Location + RL_Doors[1] ); 00581 Internal_Doors[1].BasePos = Internal_Doors[1].Location; 00582 Internal_Doors[1].SetBase( LiftCage ); 00583 Internal_Doors[1].Trigger( self, none ); 00584 waittime=max(waittime,Internal_Doors[1].MoveTime+Z_OpenDelayInternalDoor); 00585 } 00586 if ( Floor2_OuterDoors[0] != none ) 00587 { 00588 Floor2_OuterDoors[0].DelayTime=Z_OpenDelayExternalDoor; 00589 Floor2_OuterDoors[0].Trigger( self, none ); 00590 waittime=max(waittime,Floor2_OuterDoors[0].MoveTime+Z_OpenDelayExternalDoor); 00591 } 00592 if ( Floor2_OuterDoors[1] != none ) 00593 { 00594 Floor2_OuterDoors[1].DelayTime=Z_OpenDelayExternalDoor; 00595 Floor2_OuterDoors[1].Trigger( self, none ); 00596 waittime=max(waittime,Floor2_OuterDoors[1].MoveTime+Z_OpenDelayExternalDoor); 00597 } 00598 00599 if ( waittime != 0 ) 00600 SetTimer( waittime, false ); 00601 else 00602 Timer( ); 00603 } 00604 00605 EVENT Timer( ) 00606 { 00607 if ( Internal_Button != none ) { Internal_Button.CageStops( ); } 00608 if ( Floor1_CallingButton != none ) { Floor1_CallingButton.CageStops( ); } 00609 if ( Floor2_CallingButton != none ) { Floor2_CallingButton.CageStops( ); } 00610 CurrentFloorDoorsOpen = true; 00611 GotoState( '' ); 00612 } 00613 } 00614 00615 // 0 00616 // XIIIMoverVarTime'MyLevel.XIIIMoverVarTime0' 00617 // Porte'MyLevel.Porte4' 00618 // 1 00619 // XIIIMoverVarTime'MyLevel.XIIIMoverVarTime2' 00620 // Porte'MyLevel.Porte5' 00621 // 00622 // Mover'MyLevel.Mover10' 00623 00624 00625 00626 defaultproperties 00627 { 00628 CurrentFloor=1 00629 CurrentFloorDoorsOpen=True 00630 Z_TimeLiftCage=6.000000 00631 Z_TimeInternalDoors=3.000000 00632 Z_TimeExternalDoors=1.000000 00633 Z_OpenDelayExternalDoor=3.000000 00634 Z_CloseDelayInternalDoor=1.000000 00635 bAutomatic=True 00636 bDirectional=True 00637 }

End Source Code