godot-psd-training/sceen/total.gd

51 lines
1.3 KiB
GDScript3
Raw Normal View History

extends Node3D
class_name TotalScene
##开始实训,车主动来和开屏蔽门
func beginTraining ()-> void:
$train.trainCome()
$BeginTimer.start()
func _on_beginTimer_timeout() -> void:
$Timer.start()
$train.openLeftTrainDoorALL()
$platform.openScreenDoorALL()
func _on_timer_timeout() -> void:
$train.closeLeftTrainDoorALL()
$platform.closeScreenDoorALL()
$EndTimer.start()
func _on_end_timer_timeout() -> void:
$train.trainLeave()
##关屏蔽门
func closeAllScreenDoor() -> void:
pass
## 屏蔽门名字的枚举
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)