// // CPT operator / SondeerGame // This source file is (c) by Deltares. // - October 2014 // //************************************************* // // Class for the racing traffic light // //************************************************* class dialogTrafficLight extends GeoGUIPage; #exec OBJ LOAD FILE=Race.utx var automated GeoImageButton TrafficLight; var automated GeoFrameFullScreen DialogBackground; var int trafficstate; var array light[4]; function InitComponent(GUIController MyController, GUIComponent MyOwner) { Super.InitComponent(MyController, MyOwner); trafficstate = 0; light[0] = Material'Race.trafficlight_blank'; light[1] = Material'Race.trafficlight_red'; light[2] = Material'Race.trafficlight_yellow'; light[3] = Material'Race.trafficlight_green'; /// Set timer: SetTimer(1.0, true); } function Timer() { local TimerActor ta; /// Close one sec after green: if (trafficstate >= 4) { Controller.CloseMenu(true); /// Spawn timer: ta = GeoPC.Pawn.Spawn(class'TimerActor'); ta.isRunning = true; } else { TrafficLight.Graphic = light[trafficstate]; trafficstate++; } } defaultproperties { AllowSelect = true bAllowedAsLast=true bDisconnectOnOpen=false bPersistent=false Begin Object Class=GeoFrameFullScreen name=TDialogBackground End Object Begin Object Class=GeoImageButton Name=TTrafficLight WinHeight=0.6 WinWidth=0.3 WinLeft=0.4 WinTop=0.2 Graphic=Material'Race.trafficlight_blank' End Object TrafficLight = TTrafficLight; WinLeft=0.0 WinTop=0.0 WinWidth=1.0 WinHeight=1.0 }