godot-psd-training/sceen/total.gd

51 lines
1.5 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 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)
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)