godot-psd-training/sceen/total.gd

99 lines
2.6 KiB
GDScript3
Raw Normal View History

extends Node3D
class_name TotalScene
##车来且开屏蔽门和车门
func trainComeAndOpenScreenDoor ()-> void:
$train.trainCome()
$BeginTimer.start()
func _on_beginTimer_timeout() -> void:
$train.openLeftTrainDoorALL()
$platform.openScreenDoorALL()
##关屏蔽门和车门且车走
func closeScreenDoorAndTrainLeave ()-> void:
closeScreenDoor()
$EndTimer.start()
func _on_end_timer_timeout() -> void:
trainLeave()
##关屏蔽门和车门
func closeScreenDoor() -> void:
$train.closeLeftTrainDoorALL()
$platform.closeScreenDoorALL()
##车走
func trainLeave() -> void:
$train.trainLeave()
## 屏蔽门名字的枚举
enum ScreenDoor_name{
screenDoor1=1,
screenDoor2,
screenDoor3,
screenDoor4,
}
##设置指定屏蔽门开门故障
func setAssignScreenDoorsOpenFault (screenDoorNames:Array)-> void:
2024-05-08 16:15:27 +08:00
setAssignScreenDoorsFault(screenDoorNames,ScreenDoor.ScreenDoor_Fault_State.openFault)
##设置指定屏蔽门关门故障
func setAssignScreenDoorsCloseFault (screenDoorNames:Array)-> void:
2024-05-08 16:15:27 +08:00
setAssignScreenDoorsFault(screenDoorNames,ScreenDoor.ScreenDoor_Fault_State.closeFault)
##设置指定屏蔽门玻璃破碎故障
func setAssignScreenDoorsGlassBreakageFault (screenDoorNames:Array)-> void:
setAssignScreenDoorsFault(screenDoorNames,ScreenDoor.ScreenDoor_Fault_State.glassBreakage)
2024-05-10 16:53:03 +08:00
##设置指定屏蔽门夹人故障
func setAssignScreenDoorsPinchPeopleFault (screenDoorNames:Array)-> void:
setAssignScreenDoorsFault(screenDoorNames,ScreenDoor.ScreenDoor_Fault_State.pinchPeople)
2024-05-08 16:15:27 +08:00
func setAssignScreenDoorsFault (screenDoorNames:Array,faultType:ScreenDoor.ScreenDoor_Fault_State)-> void:
for child in $platform.screenDoorALL:
var screenDoorName=String(child.name)
var screenDoorIndex=int(screenDoorName[screenDoorName.length() - 1])
if screenDoorIndex in screenDoorNames:
2024-05-08 16:15:27 +08:00
child.setScreenDoorFault(faultType)
##所有交互操作汇总
func _on_platform_all_click_platform_signal(equipmentName: String,equipmentInfo=null) -> void:
print(equipmentName,equipmentInfo,6666)
const allClickEquipmentInfo = {
"LCB1": "hhh",
"LCB2": "hhh",
"LCB3": "hhh",
"LCB4": "hhh",
"PSL": "hhh",
"JJTC": "hhh",
"screenDoor1RightClick": "hhh",
"screenDoor2RightClick": "hhh",
"screenDoor3RightClick": "hhh",
"screenDoor4RightClick": "hhh",
"LCB_Key1": "hhh",
"LCB_Key2": "hhh",
"LCB_Key3": "hhh",
"LCB_Key4": "hhh",
"JJTC_Key": "hhh",
"PSL_Key": "hhh",
"HSJC_Key": "hhh",
"SDJS_Key": "hhh",
"confirmUseKey": "hhh",
"PSLAllow": "hhh",
"CloseDoorButton": "hhh",
"OpenDoorButton": "hhh",
"InterlockReleaseSwitch": "hhh",
"LightTestButton": "hhh",
"trainDepartsButton": "hhh",
"interconnectedCloseButton": "hhh",
"interconnectedOpenButton": "hhh",
}