total场景增加设置指定屏蔽门开关门故障

This commit is contained in:
joylink_zhaoerwei 2024-05-07 16:33:38 +08:00
parent 3873a0944d
commit 28dff193c4
5 changed files with 35 additions and 7 deletions

View File

@ -102,9 +102,9 @@ size_flags_horizontal = 4
buttonType = 2
buttonText = "灯测试按钮"
[node name="PSTHandle" parent="MarginContainer/GridContainer" instance=ExtResource("6_8mvyb")]
[node name="PSTHandle" parent="MarginContainer/GridContainer" instance=ExtResource("6_nn68f")]
layout_mode = 2
size_flags_horizontal = 6
lightType = 1
lightText = "PST操作指示灯"
[node name="trainDepartsButton" parent="MarginContainer/GridContainer" instance=ExtResource("7_p8tve")]
@ -137,7 +137,6 @@ texture = ExtResource("7_643a1")
[connection signal="clickKeySwitchSignal" from="MarginContainer/GridContainer/InterlockReleaseSwitch" to="." method="onHandleSignal"]
[connection signal="removeKey" from="MarginContainer/GridContainer/InterlockReleaseSwitch" to="." method="remove_key"]
[connection signal="clickButtonSignal" from="MarginContainer/GridContainer/MarginContainer2/VBoxContainer/LightTestButton" to="." method="onHandleSignal"]
[connection signal="clickKeySwitchSignal" from="MarginContainer/GridContainer/PSTHandle" to="." method="onHandleSignal"]
[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"]

View File

@ -26,7 +26,7 @@ func allScreenDoorClose ()-> bool:
return false
return true
##有屏蔽门门到位
##有屏蔽门门到位
func hasScreenDoorOpen ()-> bool:
for child in screenDoorALL:
if child.screenDoorState == ScreenDoor.ScreenDoor_State.open :

View File

@ -33,10 +33,10 @@ enum ScreenDoor_State{
set(value):
if screenDoorState != value:
screenDoorState = value
if screenDoorState == ScreenDoor_State.opening :
if screenDoorState == ScreenDoor_State.opening and screenDoorFaultState != ScreenDoor_Fault_State.openFault:
left_animation_player.play("leftOpen")
right_animation_player.play("rightOpen")
elif screenDoorState == ScreenDoor_State.closeing :
elif screenDoorState == ScreenDoor_State.closeing and screenDoorFaultState != ScreenDoor_Fault_State.closeFault :
left_animation_player.play("leftClose")
right_animation_player.play("rightClose")

27
sceen/total.gd Normal file
View File

@ -0,0 +1,27 @@
extends Node3D
class_name TotalScene
## 屏蔽门名字的枚举
enum ScreenDoor_name{
screenDoor1=1,
screenDoor2,
screenDoor3,
screenDoor4,
}
##设置指定屏蔽门开门故障
func setAssignScreenDoorsOpenFault (screenDoorNames:Array)-> void:
for child in $platform.screenDoorALL:
var screenDoorName=String(child.name)
var screenDoorIndex=int(screenDoorName[screenDoorName.length() - 1])
if screenDoorIndex in screenDoorNames:
child.setScreenDoorFault(ScreenDoor.ScreenDoor_Fault_State.openFault)
##设置指定屏蔽门关门故障
func setAssignScreenDoorsCloseFault (screenDoorNames:Array)-> void:
for child in $platform.screenDoorALL:
var screenDoorName=String(child.name)
var screenDoorIndex=int(screenDoorName[screenDoorName.length() - 1])
if screenDoorIndex in screenDoorNames:
child.setScreenDoorFault(ScreenDoor.ScreenDoor_Fault_State.closeFault)

View File

@ -1,6 +1,7 @@
[gd_scene load_steps=8 format=3 uid="uid://btcksdsburk7t"]
[gd_scene load_steps=9 format=3 uid="uid://btcksdsburk7t"]
[ext_resource type="PackedScene" uid="uid://cmnsn2joxo68l" path="res://sceen/platform/platform.tscn" id="1_rjva4"]
[ext_resource type="Script" path="res://sceen/total.gd" id="1_s45rl"]
[ext_resource type="PackedScene" uid="uid://nx6xnwcuq8cf" path="res://sceen/train/train.tscn" id="14_g0uwl"]
[sub_resource type="Environment" id="Environment_ux83q"]
@ -60,6 +61,7 @@ _data = {
}
[node name="total" type="Node3D"]
script = ExtResource("1_s45rl")
[node name="platform" parent="." instance=ExtResource("1_rjva4")]