Add casting animation phases and stabilize held rod
This commit is contained in:
parent
9e6536adcd
commit
ff536e62a6
5 changed files with 97 additions and 13 deletions
|
|
@ -363,15 +363,15 @@ func handle_escape_action() -> bool:
|
|||
|
||||
|
||||
func set_local_menu_input_suppressed(
|
||||
owner: StringName,
|
||||
input_owner: StringName,
|
||||
suppressed: bool,
|
||||
) -> void:
|
||||
if owner.is_empty():
|
||||
if input_owner.is_empty():
|
||||
return
|
||||
if suppressed:
|
||||
_local_menu_input_owners[owner] = true
|
||||
_local_menu_input_owners[input_owner] = true
|
||||
else:
|
||||
_local_menu_input_owners.erase(owner)
|
||||
_local_menu_input_owners.erase(input_owner)
|
||||
if suppressed and state == FishingState.WAITING_FOR_BITE:
|
||||
_withdrawal_input_held = false
|
||||
_stop_reeling_audio()
|
||||
|
|
@ -627,6 +627,7 @@ func _begin_aiming(player: PlayerType) -> void:
|
|||
_cast_charge = 0.0
|
||||
_cast_target = _calculate_cast_target(minimum_cast_distance)
|
||||
state = FishingState.AIMING_CAST
|
||||
_active_player.set_casting_visual()
|
||||
status_changed.emit("")
|
||||
_cast_path_is_clear = is_cast_path_clear(
|
||||
_get_cast_launch_position(),
|
||||
|
|
@ -813,6 +814,8 @@ func _confirm_cast() -> void:
|
|||
# released so the active bobber/fishing event remains anchored.
|
||||
_active_player.set_movement_enabled(false)
|
||||
state = FishingState.CASTING
|
||||
if _active_player != null:
|
||||
_active_player.set_release_visual()
|
||||
status_changed.emit("")
|
||||
_presentation.begin_cast(
|
||||
_cast_target,
|
||||
|
|
@ -1102,7 +1105,7 @@ func _on_catch_encounter_updated(
|
|||
barrier_health: PackedInt32Array,
|
||||
barrier_max_health: PackedInt32Array,
|
||||
active_barrier_index: int,
|
||||
visible: bool,
|
||||
encounter_visible: bool,
|
||||
) -> void:
|
||||
catch_display_changed.emit(
|
||||
progress,
|
||||
|
|
@ -1111,9 +1114,9 @@ func _on_catch_encounter_updated(
|
|||
barrier_health,
|
||||
barrier_max_health,
|
||||
active_barrier_index,
|
||||
visible
|
||||
encounter_visible
|
||||
)
|
||||
if state != FishingState.FIGHTING or not visible:
|
||||
if state != FishingState.FIGHTING or not encounter_visible:
|
||||
return
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ func show_cast(origin: Vector3, target: Vector3) -> void:
|
|||
_bobber.visible = true
|
||||
_line.visible = true
|
||||
_owner.set_active_item_is_rod(true)
|
||||
_owner.set_release_visual()
|
||||
_redraw_line()
|
||||
_cast_tween = create_tween()
|
||||
_cast_tween.set_trans(Tween.TRANS_SINE)
|
||||
|
|
@ -99,6 +100,7 @@ func show_bite() -> void:
|
|||
func play_return(showcase_catch: FishCatch = null) -> void:
|
||||
if _owner != null and is_instance_valid(_owner):
|
||||
_owner.set_fighting_visual(false)
|
||||
_owner.set_fishing_visual(false)
|
||||
if not _active or _bobber == null:
|
||||
cleanup()
|
||||
return_completed.emit()
|
||||
|
|
@ -135,6 +137,7 @@ func cleanup() -> void:
|
|||
_bobber_idle_elapsed = 0.0
|
||||
if _owner != null and is_instance_valid(_owner):
|
||||
_owner.set_fighting_visual(false)
|
||||
_owner.set_fishing_visual(false)
|
||||
_owner.end_catch_showcase(Callable(), true)
|
||||
if _bobber != null:
|
||||
_bobber.visible = false
|
||||
|
|
@ -162,6 +165,8 @@ func _set_cast_sample(
|
|||
func _on_cast_finished() -> void:
|
||||
_cast_tween = null
|
||||
_bobber_idle_elapsed = 0.0
|
||||
if _owner != null and is_instance_valid(_owner):
|
||||
_owner.set_fishing_visual(true)
|
||||
_apply_bobber_idle_motion()
|
||||
_redraw_line()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue