27 lines
670 B
GDScript
27 lines
670 B
GDScript
extends Node3D
|
|
|
|
@onready var character = $Character as Character
|
|
|
|
var change_distance: float
|
|
var tiles: Array[Tile]
|
|
var current_tile: int = 0
|
|
|
|
|
|
func _ready() -> void:
|
|
tiles.assign(Utils.get_nodes_of_class(self, Tile))
|
|
if tiles.size() == 0:
|
|
printerr("There are no Tiles in the scene.")
|
|
return
|
|
#change_distance = tiles[current_tile].length
|
|
if character.path == null:
|
|
character.path = tiles[current_tile].path
|
|
|
|
|
|
func _process(delta: float) -> void:
|
|
if is_equal_approx(character.follow.progress_ratio, 1):
|
|
current_tile += 1
|
|
if current_tile >= tiles.size():
|
|
return
|
|
character.path = tiles[current_tile].path
|
|
#change_distance = tiles[current_tile].length
|