From 35e15773e1e71175a1160e130aee0109677a7702 Mon Sep 17 00:00:00 2001 From: joylink_zhaoerwei Date: Mon, 29 Apr 2024 15:00:41 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=88=97=E8=BD=A6=E4=B8=8E=E8=BD=A6?= =?UTF-8?q?=E9=97=A8=E7=8A=B6=E6=80=81=E5=8A=9F=E8=83=BD=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sceen/total.tscn | 3 ++ sceen/train/train.gd | 114 +++++++++++++++++++++++++-------------- sceen/train/trainDoor.gd | 36 ++++++------- 3 files changed, 93 insertions(+), 60 deletions(-) diff --git a/sceen/total.tscn b/sceen/total.tscn index d389b19..90cb596 100644 --- a/sceen/total.tscn +++ b/sceen/total.tscn @@ -68,6 +68,7 @@ _data = { [node name="Camera3D" type="Camera3D" parent="."] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -4.004, 1.768, 6.38) visible = false +current = true [node name="WorldEnvironment" type="WorldEnvironment" parent="."] environment = SubResource("Environment_ux83q") @@ -80,3 +81,5 @@ root_node = NodePath("../WorldEnvironment") libraries = { "": SubResource("AnimationLibrary_lf7ox") } + +[connection signal="animation_finished" from="trainAnimationPlayer" to="train" method="_on_train_animation_player_animation_finished"] diff --git a/sceen/train/train.gd b/sceen/train/train.gd index 8f26d87..ba1c9e4 100644 --- a/sceen/train/train.gd +++ b/sceen/train/train.gd @@ -1,51 +1,26 @@ extends Node3D -##左边的门 -class_name train +##车 +class_name Train @onready var train_animation_player: AnimationPlayer = $"../trainAnimationPlayer" +## 车的类型枚举 enum TrainType{ - four = 4,# 4编组 - six = 6,#6编组 + four = 2,# 4编组 + six = 4,#6编组 } @export var trainType:TrainType = TrainType.four -func _ready() -> void: - var trainDoor_scene = preload("res://sceen/train/trainDoor.tscn") - var lasttrainDoorPosX = -4.385 - for i in range(1, (trainType+2)*4+1): - ##有动画的屏蔽门 - var trainDoorInstance = trainDoor_scene.instantiate() - add_child(trainDoorInstance) - if i % 4 ==1 and i != 1: - trainDoorInstance.position.x=lasttrainDoorPosX+6.104 - else: - trainDoorInstance.position.x=lasttrainDoorPosX+4.385 - ##无动画的屏蔽门 - if i>1: - var copyNoMoveDoor = $NoMoveDoor.duplicate() - $".".add_child(copyNoMoveDoor) - copyNoMoveDoor.position.x = lasttrainDoorPosX - lasttrainDoorPosX = trainDoorInstance.position.x - trainDoorInstance.name = 'trainDoor{0}'.format([i]) - print(trainType) - for i in range(1, trainType): - var copyTrainBody = $TrainBody.duplicate() - $".".add_child(copyTrainBody) - copyTrainBody.position.x=19.259*(i+1) - $TrainHeadH.position.x += 19.259*(trainType-1) - - -## 门的状态枚举 +## 车的状态枚举 enum Train_STATE{ - idle = 0, - come = 1,# 车来 - leave = 2,# 车走 + come,# 进站 + comeAndStop,# 进站且停稳 + leave,# 出站 } -##门是否移动 -@onready var trainState : Train_STATE = Train_STATE.idle : +##车的状态 +@onready var trainState : Train_STATE = Train_STATE.leave : set(value): if trainState != value: trainState = value @@ -54,13 +29,74 @@ enum Train_STATE{ elif trainState == Train_STATE.leave : train_animation_player.play("trainLeave") + +##进站停车 +func trainCome ()-> void: + trainState=Train_STATE.come + + +##出站 +func trainLeave ()-> void: + trainState=Train_STATE.leave + + +func _on_train_animation_player_animation_finished(anim_name: StringName) -> void: + if anim_name == 'trainCome' : + trainState = Train_STATE.comeAndStop + + +var leftTrainDoorALL = [] + +##开左侧车门 +func openLeftTrainDoorALL ()-> void: + for child in leftTrainDoorALL: + child.openTrainDoor() + +##关左侧车门 +func closeLeftTrainDoorALL ()-> void: + for child in leftTrainDoorALL: + child.closeTrainDoor() + +func _ready() -> void: + var trainDoor_scene = preload("res://sceen/train/trainDoor.tscn") + var lasttrainDoorPosX = -4.385 + for i in range(1, (trainType+2)*4+1): + ##左侧有动画的车门 + var trainDoorInstance = trainDoor_scene.instantiate() + add_child(trainDoorInstance) + leftTrainDoorALL.append(trainDoorInstance) + if i % 4 ==1 and i != 1: + trainDoorInstance.position.x=lasttrainDoorPosX+6.104 + else: + trainDoorInstance.position.x=lasttrainDoorPosX+4.385 + ##右侧无动画的车门 + if i>1: + var copyNoMoveDoor = $NoMoveDoor.duplicate() + add_child(copyNoMoveDoor) + copyNoMoveDoor.position.x = lasttrainDoorPosX + lasttrainDoorPosX = trainDoorInstance.position.x + trainDoorInstance.name = 'trainDoor{0}'.format([i]) + for i in range(1, trainType): + var copyTrainBody = $TrainBody.duplicate() + $".".add_child(copyTrainBody) + copyTrainBody.position.x=19.259*(i+1) + $TrainHeadH.position.x += 19.259*(trainType-1) + + var count=0 func _process(delta: float) -> void: count+=1 if count<180: - trainState=Train_STATE.come + if trainState == Train_STATE.leave : + trainCome() + elif count>180 and count<360: + if leftTrainDoorALL[0].trainDoorState != 0 : + openLeftTrainDoorALL() + elif count>540 and count<720 : + if leftTrainDoorALL[0].trainDoorState != 1 : + closeLeftTrainDoorALL() elif count>1000 and count<2000: - trainState=Train_STATE.leave + if trainState == Train_STATE.comeAndStop : + trainLeave() elif count>2000: count=0 - diff --git a/sceen/train/trainDoor.gd b/sceen/train/trainDoor.gd index 748a844..de190a6 100644 --- a/sceen/train/trainDoor.gd +++ b/sceen/train/trainDoor.gd @@ -1,20 +1,19 @@ extends Node3D -##左边的门 -class_name trainDoor +##车门 +class_name TrainDoor @onready var left_animation_player: AnimationPlayer = $LeftAnimationPlayer @onready var right_animation_player: AnimationPlayer = $RightAnimationPlayer -## 门的状态枚举 +## 车门的状态枚举 enum Train_Door_STATE{ - idle = 0, - open = 1,# 开门 - close = 2,# 关门 + open,# 开门 + close,# 关门 } -##门是否移动 -@onready var trainDoorState : Train_Door_STATE = Train_Door_STATE.idle : +##车门的状态 +@onready var trainDoorState : Train_Door_STATE = Train_Door_STATE.close : set(value): if trainDoorState != value: trainDoorState = value @@ -25,17 +24,12 @@ enum Train_Door_STATE{ left_animation_player.play("leftClose") right_animation_player.play("rightClose") -var count=0 -func _process(delta: float) -> void: - count+=1 - if count>180 and count<360: - trainDoorState=Train_Door_STATE.open - elif count>540 and count<720 : - if self.name != "trainDoor2": - trainDoorState=Train_Door_STATE.close - elif count>720 and count<1000 : - if self.name == "trainDoor2": - trainDoorState=Train_Door_STATE.close - elif count>2000 : - count=0 +##打开车门 +func openTrainDoor ()-> void: + trainDoorState=Train_Door_STATE.open + + +##关闭车门 +func closeTrainDoor ()-> void: + trainDoorState=Train_Door_STATE.close From 4566ee905e5a5058fc1e93b8834916256e1fea57 Mon Sep 17 00:00:00 2001 From: joylink_zhaoerwei Date: Mon, 29 Apr 2024 17:13:14 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=B1=8F=E8=94=BD=E9=97=A8=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E5=8A=9F=E8=83=BD=E8=B0=83=E6=95=B4=EF=BC=8C=E5=BE=85?= =?UTF-8?q?=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- UI/JJTC/jjlc.gd | 4 +- UI/LCB/lcb.gd | 7 +- UI/psl/psl_window.gd | 28 +++++-- UI/psl/psl_window.tscn | 26 ++++-- UI/station_keys/station_keys_window.gd | 3 + sceen/platform/platform.gd | 25 ++++++ sceen/platform/screenDoor.gd | 108 ++++++++++++++----------- sceen/platform/screenDoor.tscn | 1 + sceen/train/train.gd | 4 +- 9 files changed, 137 insertions(+), 69 deletions(-) diff --git a/UI/JJTC/jjlc.gd b/UI/JJTC/jjlc.gd index 7b81b0f..1588164 100644 --- a/UI/JJTC/jjlc.gd +++ b/UI/JJTC/jjlc.gd @@ -2,7 +2,7 @@ extends Window func _on_jjtc_click_jjtc_signal(): self.show() - $"../stationKeys".onShowWindow($"../stationKeys".WindowType.JJTC) + $"../stationKeys".onShowWindow(StationKeyWindow.WindowType.JJTC) func _on_close_requested(): @@ -12,7 +12,7 @@ func _on_close_requested(): func _on_station_keys_gui_input(event): if event.button_mask == MouseButtonMask.MOUSE_BUTTON_MASK_LEFT: - $"../stationKeys".onShowWindow($"../stationKeys".WindowType.JJTC) + $"../stationKeys".onShowWindow(StationKeyWindow.WindowType.JJTC) func shouJJTCKey(): $JJTC_Key.show() diff --git a/UI/LCB/lcb.gd b/UI/LCB/lcb.gd index 2fe6912..389cd74 100644 --- a/UI/LCB/lcb.gd +++ b/UI/LCB/lcb.gd @@ -1,11 +1,14 @@ extends Window +##lcb面板 +class_name LcbWindow + var currenScreenDoor:ScreenDoor=null func _on_screen_door_click_lcb_signal(screenDoor: Variant) -> void: var screenDoorName=String(screenDoor.name) self.title='LCB'+screenDoorName[screenDoorName.length() - 1] self.show() - $"../stationKeys".onShowWindow($"../stationKeys".WindowType.LCB,screenDoor.lcbKey.keyName) + $"../stationKeys".onShowWindow(StationKeyWindow.WindowType.LCB,screenDoor.lcbKey.keyName) currenScreenDoor=screenDoor resetState(screenDoor.lcbKey) @@ -70,7 +73,7 @@ func resetState(lcbKey): ##打开钥匙盒相关 func _on_open_key_window_gui_input(event: InputEvent) -> void: if event.button_mask == MouseButtonMask.MOUSE_BUTTON_MASK_LEFT: - $"../stationKeys".onShowWindow($"../stationKeys".WindowType.LCB,currenScreenDoor.lcbKey.keyName) + $"../stationKeys".onShowWindow(StationKeyWindow.WindowType.LCB,currenScreenDoor.lcbKey.keyName) func _on_open_key_window_mouse_entered() -> void: diff --git a/UI/psl/psl_window.gd b/UI/psl/psl_window.gd index 7f26b02..6c25535 100644 --- a/UI/psl/psl_window.gd +++ b/UI/psl/psl_window.gd @@ -3,20 +3,22 @@ extends Window func _on_psl_click_signal() -> void: self.show() - $"../stationKeys".onShowWindow($"../stationKeys".WindowType.PSL) + $"../stationKeys".onShowWindow(StationKeyWindow.WindowType.PSL) if !$"../stationKeys".hsjcKeyVisible() : hideInterlockReleaseSwitchHandleKey() if !$"../stationKeys".pslKeyVisible() : hidePSLAllowHandleKey() - - func _on_close_requested(): self.hide() $"../stationKeys".hide() - +##点击按钮或钥匙 +func onHandleSignal(openLight: bool, keySwitch: Variant) -> void: + print(openLight,keySwitch,666) + + func shouPSLAllowHandleKey(): $MarginContainer/GridContainer/PSLAllow.shouHandleKey() @@ -32,10 +34,6 @@ func hideInterlockReleaseSwitchHandleKey(): $MarginContainer/GridContainer/InterlockReleaseSwitch.hideHandleKey() -func onHandleSignal(openLight: bool, keySwitch: Variant) -> void: - print(openLight,keySwitch,666) - - func remove_key(keyName: Variant) -> void: var name = '' if keyName == 'PSLAllow' : @@ -43,3 +41,17 @@ func remove_key(keyName: Variant) -> void: elif keyName == 'InterlockReleaseSwitch' : name = 'HSJC_Key' $"../stationKeys".showKeyAfterRemoveKey(name) + + +##打开钥匙盒相关 +func _on_open_key_window_gui_input(event: InputEvent) -> void: + if event.button_mask == MouseButtonMask.MOUSE_BUTTON_MASK_LEFT: + $"../stationKeys".onShowWindow(StationKeyWindow.WindowType.PSL) + + +func _on_open_key_window_mouse_entered() -> void: + $openKeyWindow.set_default_cursor_shape(Control.CursorShape.CURSOR_POINTING_HAND) + + +func _on_open_key_window_mouse_exited() -> void: + $openKeyWindow.set_default_cursor_shape(Control.CursorShape.CURSOR_ARROW) diff --git a/UI/psl/psl_window.tscn b/UI/psl/psl_window.tscn index 415888c..bd840d9 100644 --- a/UI/psl/psl_window.tscn +++ b/UI/psl/psl_window.tscn @@ -1,16 +1,17 @@ -[gd_scene load_steps=7 format=3 uid="uid://dppmr7ifqt8oa"] +[gd_scene load_steps=8 format=3 uid="uid://dppmr7ifqt8oa"] [ext_resource type="Theme" uid="uid://bycedcl2nwwlu" path="res://ui_theme.tres" id="1_oaabl"] [ext_resource type="FontFile" uid="uid://bkbpyidjguavf" path="res://Assets/FeiHuaSongTi-2.ttf" id="2_xva5j"] [ext_resource type="Script" path="res://UI/psl/psl_window.gd" id="3_xodem"] [ext_resource type="Texture2D" uid="uid://dkohhsnyl7dq8" path="res://Assets/psl/psl背景大.png" id="4_cpydh"] [ext_resource type="PackedScene" uid="uid://ur86pfy4w0so" path="res://UI/psl/key_switch.tscn" id="6_8mvyb"] +[ext_resource type="Texture2D" uid="uid://cpmlwpev7rvbp" path="res://Assets/打开钥匙面板钥匙.png" id="7_643a1"] [ext_resource type="PackedScene" uid="uid://c31r8s27j4dcm" path="res://UI/psl/button_light.tscn" id="7_l5iwy"] [node name="psl" type="Window"] title = "psl操作面板" position = Vector2i(10, 36) -size = Vector2i(400, 720) +size = Vector2i(460, 720) unresizable = true transparent = true theme = ExtResource("1_oaabl") @@ -18,15 +19,15 @@ theme_override_fonts/title_font = ExtResource("2_xva5j") script = ExtResource("3_xodem") [node name="Pslll" type="Sprite2D" parent="."] -position = Vector2(0.255, 0) -scale = Vector2(2.66, 2.865) +position = Vector2(220, 0) +scale = Vector2(0.43, 1.14) texture = ExtResource("4_cpydh") [node name="MarginContainer" type="MarginContainer" parent="."] -offset_left = 4.0 +offset_left = 30.0 offset_top = 4.0 -offset_right = 436.0 -offset_bottom = 1459.0 +offset_right = 537.0 +offset_bottom = 1529.0 scale = Vector2(0.7, 0.7) theme_override_constants/margin_left = 45 theme_override_constants/margin_top = 35 @@ -109,6 +110,14 @@ layout_mode = 2 buttonHasLight = false buttonText = "联动开门按钮" +[node name="openKeyWindow" type="TextureRect" parent="."] +offset_left = 405.0 +offset_top = 50.0 +offset_right = 473.0 +offset_bottom = 200.0 +scale = Vector2(0.64, 0.64) +texture = ExtResource("7_643a1") + [connection signal="close_requested" from="." to="." method="_on_close_requested"] [connection signal="clickKeySwitchSignal" from="MarginContainer/GridContainer/PSLAllow" to="." method="onHandleSignal"] [connection signal="removeKey" from="MarginContainer/GridContainer/PSLAllow" to="." method="remove_key"] @@ -122,3 +131,6 @@ buttonText = "联动开门按钮" [connection signal="clickButtonSignal" from="MarginContainer/GridContainer/trainDepartsButton" to="." method="onHandleSignal"] [connection signal="clickButtonSignal" from="MarginContainer/GridContainer/interconnectedCloseButton" to="." method="onHandleSignal"] [connection signal="clickButtonSignal" from="MarginContainer/GridContainer/interconnectedOpenButton" to="." method="onHandleSignal"] +[connection signal="gui_input" from="openKeyWindow" to="." method="_on_open_key_window_gui_input"] +[connection signal="mouse_entered" from="openKeyWindow" to="." method="_on_open_key_window_mouse_entered"] +[connection signal="mouse_exited" from="openKeyWindow" to="." method="_on_open_key_window_mouse_exited"] diff --git a/UI/station_keys/station_keys_window.gd b/UI/station_keys/station_keys_window.gd index fe7ade5..f099307 100644 --- a/UI/station_keys/station_keys_window.gd +++ b/UI/station_keys/station_keys_window.gd @@ -1,5 +1,8 @@ extends Window +##钥匙面板 +class_name StationKeyWindow + var current_focus: CanvasItem ## 打开的面板类型枚举 diff --git a/sceen/platform/platform.gd b/sceen/platform/platform.gd index 8c77e12..4acd938 100644 --- a/sceen/platform/platform.gd +++ b/sceen/platform/platform.gd @@ -1,5 +1,16 @@ extends Node3D +var screenDoorALL = [] + +##开整体屏蔽门 +func openScreenDoorALL ()-> void: + for child in screenDoorALL: + child.openScreenDoor() + +##关整体屏蔽门 +func closeScreenDoorALL ()-> void: + for child in screenDoorALL: + child.closeScreenDoor() func _ready() -> void: var screenDoor_scene = preload("res://sceen/platform/screenDoor.tscn") @@ -7,6 +18,20 @@ func _ready() -> void: for i in range(1, 5): var screenDoorInstance = screenDoor_scene.instantiate() add_child(screenDoorInstance) + screenDoorALL.append(screenDoorInstance) screenDoorInstance.position.x=(i-1)*4.385 screenDoorInstance.name = 'screenDoor{0}'.format([i]) screenDoorInstance.connect("clickLcbSignalAndSent",Callable($LCB,"_on_screen_door_click_lcb_signal")) + + +var count=0 +func _process(delta: float) -> void: + count+=1 + if count>150 and count<360: + if screenDoorALL[0].screenDoorState == ScreenDoor.ScreenDoor_State.close: + openScreenDoorALL() + elif count>540 and count<720 : + if screenDoorALL[0].screenDoorState == ScreenDoor.ScreenDoor_State.open: + closeScreenDoorALL() + elif count>2000 : + count=0 diff --git a/sceen/platform/screenDoor.gd b/sceen/platform/screenDoor.gd index 64ea9c7..b232dcb 100644 --- a/sceen/platform/screenDoor.gd +++ b/sceen/platform/screenDoor.gd @@ -5,68 +5,80 @@ class_name ScreenDoor @onready var left_animation_player: AnimationPlayer = $LeftAnimationPlayer @onready var right_animation_player: AnimationPlayer = $RightAnimationPlayer - -signal clickLcbSignalAndSent(screenDoor,hasKey) - -## Lcb旋钮的状态枚举 -enum KNOB_STATE{ - ISOLATE,# 隔离 - AUTO,# 自动 - OPEN,# 开门 - CLOSE,# 关门 -} - -class LcbKeyWindow : - var keyName: String - var keyState:KNOB_STATE - func _init(keyName: String, keyState: KNOB_STATE): - self.keyName = keyName - self.keyState = keyState - - -var lcbKey = LcbKeyWindow.new('',KNOB_STATE.AUTO) - -func _on_lcb_click() -> void: - self.clickLcbSignalAndSent.emit(self) - - ## 屏蔽门的状态枚举 -enum Screen_Door_STATE{ - idle = 0, - open = 1,# 开门 - close = 2,# 关门 +enum ScreenDoor_State{ + opening,# 正在开门 + open,#开到位 + closeing,#正在关门 + close,# 关到位 } ##屏蔽门的状态 -@onready var screenDoorState : Screen_Door_STATE = Screen_Door_STATE.idle : +@onready var screenDoorState : ScreenDoor_State = ScreenDoor_State.close : set(value): if screenDoorState != value: screenDoorState = value - if screenDoorState == Screen_Door_STATE.open : + if screenDoorState == ScreenDoor_State.opening : left_animation_player.play("leftOpen") right_animation_player.play("rightOpen") - elif screenDoorState == Screen_Door_STATE.close : + elif screenDoorState == ScreenDoor_State.closeing : left_animation_player.play("leftClose") right_animation_player.play("rightClose") ##打开屏蔽门 func openScreenDoor ()-> void: - screenDoorState=Screen_Door_STATE.open - + if screenDoorState == ScreenDoor_State.close : + screenDoorState=ScreenDoor_State.opening + + ##关闭屏蔽门 func closeScreenDoor ()-> void: - screenDoorState=Screen_Door_STATE.close + if screenDoorState == ScreenDoor_State.open : + screenDoorState=ScreenDoor_State.closeing -var count=0 -func _process(delta: float) -> void: - count+=1 - if count>150 and count<360: - screenDoorState=Screen_Door_STATE.open - elif count>540 and count<720 : - if self.name != "screenDoor2" and self.name != "screenDoor4": - screenDoorState=Screen_Door_STATE.close - elif count>720 and count<1000 : - if self.name == "screenDoor2": - screenDoorState=Screen_Door_STATE.close - elif count>2000 : - count=0 + +func _on_left_animation_player_animation_finished(anim_name: StringName) -> void: + if anim_name == 'leftOpen': + screenDoorState = ScreenDoor_State.open + elif anim_name == 'leftClose': + screenDoorState = ScreenDoor_State.close + +## 屏蔽门的故障枚举 +enum ScreenDoor_Fault_State{ + noFault,#无故障 + openFault,# 开门故障 + closeFault,# 关门故障 + pinchPeople,#夹人 + glassBreakage,#玻璃破碎 +} + +##屏蔽门的故障状态 +@onready var screenDoorFaultState : ScreenDoor_Fault_State = ScreenDoor_Fault_State.noFault : + set(value): + if screenDoorFaultState != value: + screenDoorFaultState = value + +##设置故障 +func setScreenDoorFault (faultType:ScreenDoor_Fault_State)-> void: + screenDoorFaultState = faultType + +##恢复故障 +func removeScreenDoorFault ()-> void: + screenDoorFaultState = ScreenDoor_Fault_State.noFault + + + +##以下是lcb相关 +class LcbKeyWindow : + var keyName: String + var keyState:LcbWindow.KNOB_STATE + func _init(keyName: String, keyState: LcbWindow.KNOB_STATE): + self.keyName = keyName + self.keyState = keyState + +var lcbKey = LcbKeyWindow.new('',LcbWindow.KNOB_STATE.AUTO) + +signal clickLcbSignalAndSent(screenDoor) + +func _on_lcb_click() -> void: + self.clickLcbSignalAndSent.emit(self) diff --git a/sceen/platform/screenDoor.tscn b/sceen/platform/screenDoor.tscn index 634057b..fb8b77e 100644 --- a/sceen/platform/screenDoor.tscn +++ b/sceen/platform/screenDoor.tscn @@ -256,3 +256,4 @@ libraries = { } [connection signal="clickLcbSignal" from="LCB" to="." method="_on_lcb_click"] +[connection signal="animation_finished" from="LeftAnimationPlayer" to="." method="_on_left_animation_player_animation_finished"] diff --git a/sceen/train/train.gd b/sceen/train/train.gd index ba1c9e4..ae29523 100644 --- a/sceen/train/train.gd +++ b/sceen/train/train.gd @@ -90,10 +90,10 @@ func _process(delta: float) -> void: if trainState == Train_STATE.leave : trainCome() elif count>180 and count<360: - if leftTrainDoorALL[0].trainDoorState != 0 : + if leftTrainDoorALL[0].trainDoorState == TrainDoor.Train_Door_STATE.close: openLeftTrainDoorALL() elif count>540 and count<720 : - if leftTrainDoorALL[0].trainDoorState != 1 : + if leftTrainDoorALL[0].trainDoorState == TrainDoor.Train_Door_STATE.open : closeLeftTrainDoorALL() elif count>1000 and count<2000: if trainState == Train_STATE.comeAndStop :