init
This commit is contained in:
commit
b99855351d
434 changed files with 50357 additions and 0 deletions
29
scripts/npc/npc_path_follow.gd
Normal file
29
scripts/npc/npc_path_follow.gd
Normal file
|
@ -0,0 +1,29 @@
|
|||
extends Path3D
|
||||
|
||||
var can_move: bool
|
||||
@export var maxSpeed = 0.01
|
||||
|
||||
var pos = 0.0;
|
||||
@onready var character_body_3d = $PathFollow3D/CharacterBody3D
|
||||
|
||||
@export var character_id: String
|
||||
|
||||
func _ready():
|
||||
DialogueManager.dialogue_finished.connect(_quit_dialogue)
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
var previous_pos = pos;
|
||||
character_body_3d.moving = can_move
|
||||
if can_move and pos < 1:
|
||||
pos += maxSpeed * delta
|
||||
|
||||
if previous_pos != pos:
|
||||
character_body_3d.animate_move()
|
||||
else:
|
||||
character_body_3d.animate_idle()
|
||||
|
||||
$PathFollow3D.progress_ratio = clamp(pos, 0, 1)
|
||||
|
||||
func _quit_dialogue(_time_to_add: int):
|
||||
can_move = !character_id.is_empty() && DialogueManager.global_variables[character_id];
|
Loading…
Add table
Add a link
Reference in a new issue