extends Node3D class_name Actor enum ACTOR_STATE {INACTIVE, ACTIVE} var actor_state = null: set = state_change const red = preload("res://tiles/base_tile/red.tres") var target = null var next_step = null var temp_speed = 4 var time = 0 var current_tile = null: set = change_current_tile var current_room = null signal current_tile_request func state_change(state): actor_state = state match state: ACTOR_STATE.ACTIVE: $SelfMesh.set_material_override(red) next_step = Vector3(1, 0, 1) func _process(delta: float) -> void: #var velocity = Vector3.ZERO if actor_state == ACTOR_STATE.ACTIVE: get_current_tile() if next_step: if self.position.distance_to(next_step) > .1: #velocity = self.position.direction_to(next_step) * temp_speed position = lerp(next_step, self.position, 0.995) else: actor_state = ACTOR_STATE.INACTIVE func get_current_tile(): emit_signal("current_tile_request", self) func change_current_tile(new_tile): if current_tile != new_tile: current_tile = new_tile get_room() prints(current_tile, current_room) func get_room(): if current_tile.lookup_tile_to_room: current_room = current_tile.lookup_tile_to_room[0] else: current_room = null