60 lines
1.7 KiB
GDScript
60 lines
1.7 KiB
GDScript
extends Node3D
|
|
|
|
var screenDoorALL = []
|
|
|
|
##开整体屏蔽门
|
|
func openScreenDoorALL ()-> void:
|
|
for child in screenDoorALL:
|
|
child.openScreenDoor()
|
|
|
|
##关整体屏蔽门
|
|
func closeScreenDoorALL ()-> void:
|
|
for child in screenDoorALL:
|
|
child.closeScreenDoor()
|
|
|
|
##所有屏蔽门开门到位
|
|
func allScreenDoorOpen ()-> bool:
|
|
for child in screenDoorALL:
|
|
if child.screenDoorState != ScreenDoor.ScreenDoor_State.open :
|
|
return false
|
|
return true
|
|
|
|
##所有屏蔽门关门到位
|
|
func allScreenDoorClose ()-> bool:
|
|
for child in screenDoorALL:
|
|
if child.screenDoorState != ScreenDoor.ScreenDoor_State.close :
|
|
return false
|
|
return true
|
|
|
|
##有屏蔽门关门到位
|
|
func hasScreenDoorOpen ()-> bool:
|
|
for child in screenDoorALL:
|
|
if child.screenDoorState == ScreenDoor.ScreenDoor_State.open :
|
|
return true
|
|
return false
|
|
|
|
func _ready() -> void:
|
|
var screenDoor_scene = preload("res://sceen/platform/screenDoor.tscn")
|
|
|
|
for i in range(1, 5):
|
|
var screenDoorInstance = screenDoor_scene.instantiate()
|
|
add_child(screenDoorInstance)
|
|
screenDoorALL.append(screenDoorInstance)
|
|
screenDoorInstance.position.x=(i-1)*4.385
|
|
screenDoorInstance.name = 'screenDoor{0}'.format([i])
|
|
screenDoorInstance.connect("clickLcbSignalAndSent",Callable($LCB,"_on_screen_door_click_lcb_signal"))
|
|
screenDoorInstance.connect("clicksScreenDoorSignal",Callable($ScreenDoorOperate,"_on_screen_door_click_signal"))
|
|
|
|
|
|
var count=0
|
|
func _process(delta: float) -> void:
|
|
count+=1
|
|
if count>150 and count<360:
|
|
if screenDoorALL[0].screenDoorState == ScreenDoor.ScreenDoor_State.close:
|
|
openScreenDoorALL()
|
|
elif count>540 and count<720 :
|
|
if screenDoorALL[0].screenDoorState == ScreenDoor.ScreenDoor_State.open:
|
|
closeScreenDoorALL()
|
|
elif count>2000 :
|
|
count=0
|