20 lines
862 B
GDScript
20 lines
862 B
GDScript
extends "res://SetPiece_.gd"
|
|
|
|
@export var target_transition: String
|
|
@export_file("*.tscn") var target
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready():
|
|
super()
|
|
|
|
|
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
func _process(delta):
|
|
super(delta)
|
|
|
|
func default_script(scene: Scene):
|
|
var path = NavigationServer2D.map_get_path(scene.map, scene.pathfind.to_local(scene.ego.global_position), scene.pathfind.to_local($"exit".global_position), true)
|
|
scene.start_main_script(scene.ScriptBuilder.init(scene.ScriptBuilder.walk_path(scene.ego, path))
|
|
.and_then(scene.ScriptBuilder.transition(scene, load(target), target_transition + "/exit"))
|
|
.and_then(scene.ScriptBuilder.walk_to_deferred(target_transition + "/exit", target_transition + "/entrance"))
|
|
.can_interrupt().build(scene, "_on_script_complete"))
|