mirror of
https://gitee.com/freeyz/godot-mota.git
synced 2024-12-23 07:39:19 +08:00
16 lines
485 B
GDScript
16 lines
485 B
GDScript
extends Node
|
|
|
|
const floor_file_path = "res://scenes/floors/Floor"
|
|
|
|
# 加载指定楼层
|
|
func load_by_floor(f:int) -> void:
|
|
var root = get_tree().get_root().get_node("Main")
|
|
var next_floor = load("%s%s%s" % [floor_file_path,f,".tscn"]).instance() as Node2D
|
|
var used_items = GameArchiveManager.get_used_item(f)
|
|
root.get_node("Floor%s" % f).free()
|
|
root.add_child(next_floor)
|
|
for used_item in used_items:
|
|
var node = next_floor.get_node(used_item)
|
|
if node != null:
|
|
node.free()
|