39 lines
962 B
GDScript
39 lines
962 B
GDScript
extends LimboState
|
|
|
|
@export var grap_hook_shooting_time: float
|
|
|
|
var _timer: float
|
|
|
|
func _setup() -> void:
|
|
self.add_event_handler(&"completed_grap_hook",_handle_hook_input_completed)
|
|
agent.spawn_hook_comp.hook_reach_finished.connect(_handle_hook_stretching_end)
|
|
|
|
func _enter() -> void:
|
|
agent.locomotion_comp.suspend_movement()
|
|
agent.locomotion_comp.stop_dash(true)
|
|
|
|
var d = agent.get_move_input() as Vector2
|
|
agent.spawn_hook_comp.spawn_grap_hook_inst(d)
|
|
|
|
func _update(delta: float) -> void:
|
|
pass
|
|
|
|
func _exit() -> void:
|
|
#agent.locomotion_comp.enable_movement()
|
|
pass
|
|
|
|
func _handle_hook_input_completed() -> bool:
|
|
return true
|
|
agent.spawn_hook_comp.suspend_hook_stretching(false)
|
|
return true
|
|
|
|
func _handle_hook_stretching_end(reach_end: bool,Anchor:Node2D) -> void:
|
|
|
|
##如果鈎爪沒有找到任何錨點,則直接退出
|
|
if not Anchor:
|
|
if agent.is_on_floor():
|
|
self.dispatch(&"exit_on_ground")
|
|
else:
|
|
self.dispatch(&"exit_on_air")
|
|
return
|