goodnight_jellybean/godot/AnimationTree.gd

28 lines
677 B
GDScript3
Raw Normal View History

2022-12-31 02:49:32 -07:00
extends AnimationTree
export var TARGET_FRAMERATE = 5
2023-01-01 02:23:56 -07:00
onready var fsm: AnimationNodeStateMachinePlayback = get("parameters/playback")
func _ready():
var _err = GlobalCursorState.connect("set_camera_zone", 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)
2023-01-01 14:02:34 -07:00
GlobalCursorState.freeze()
2023-01-01 02:23:56 -07:00
yield(get_tree().create_timer(3), "timeout")
emit_signal("motion_status", false)
2023-01-01 14:02:34 -07:00
GlobalCursorState.unfreeze()
2022-12-31 02:49:32 -07:00
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