godot-psd-training/sceen/platform/gate/gate.gd
2024-07-16 11:00:51 +08:00

24 lines
589 B
GDScript

extends Node3D
var gateDoorALL:Array[GateDoor] = []
##闸机打开
func openGateDoorByIndex(index:int)-> void:
gateDoorALL[index-1].openGateDoor()
##闸机关闭
func closeGateDoorByIndex(index:int)-> void:
gateDoorALL[index-1].closeGateDoor()
func _ready() -> void:
var gateDoor_scene = preload("res://sceen/platform/gate/gateDoor.tscn")
for i in range(1, 6):
var gateDoorInstance = gateDoor_scene.instantiate()
add_child(gateDoorInstance)
gateDoorALL.append(gateDoorInstance)
gateDoorInstance.name = 'gateDoor{0}'.format([i])
gateDoorInstance.position.x= (i-1) *0.9