1
0
mirror of https://gitee.com/freeyz/godot-mota.git synced 2024-12-23 12:29:22 +08:00
godot-mota/scripts/GameFloorManager.gd

16 lines
485 B
GDScript3
Raw Normal View History

2020-07-23 15:47:32 +08:00
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()