godot-psd-training/sceen/total.gd
2024-05-10 11:34:01 +08:00

59 lines
1.6 KiB
GDScript

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:
setAssignScreenDoorsFault(screenDoorNames,ScreenDoor.ScreenDoor_Fault_State.openFault)
##设置指定屏蔽门关门故障
func setAssignScreenDoorsCloseFault (screenDoorNames:Array)-> void:
setAssignScreenDoorsFault(screenDoorNames,ScreenDoor.ScreenDoor_Fault_State.closeFault)
##设置指定屏蔽门玻璃破碎故障
func setAssignScreenDoorsGlassBreakageFault (screenDoorNames:Array)-> void:
setAssignScreenDoorsFault(screenDoorNames,ScreenDoor.ScreenDoor_Fault_State.glassBreakage)
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:
child.setScreenDoorFault(faultType)