goodnight_jellybean/godot/AnimationTree.gd

28 lines
683 B
GDScript

extends AnimationTree
@export var TARGET_FRAMERATE = 5
@onready var fsm: AnimationNodeStateMachinePlayback = get("parameters/playback")
func _ready():
var _err = GlobalCursorState.connect("set_camera_zone",Callable(self,"move"))
signal motion_status(value)
func move(where: String):
if where == fsm.get_current_node():
return
fsm.travel(where)
emit_signal("motion_status", true)
GlobalCursorState.freeze()
await get_tree().create_timer(3).timeout
emit_signal("motion_status", false)
GlobalCursorState.unfreeze()
var time_buffer = 0.0
func _process(delta):
time_buffer += delta
if time_buffer >= (1.0 / TARGET_FRAMERATE):
advance(time_buffer)
time_buffer = 0.0