generated from krampus/template-godot4
67 lines
1.5 KiB
GDScript
67 lines
1.5 KiB
GDScript
class_name ShotHUD extends Control
|
|
## HUD for main gameplay loop
|
|
|
|
@onready var power_bar: ProgressBar = %PowerBar
|
|
@onready var curve_bar: ProgressBar = %CurveBar
|
|
|
|
@onready var club_selector: ClubSelector = %ClubSelector
|
|
|
|
@onready var hud_state_machine: AnimationTree = %HUDStateMachine
|
|
|
|
@onready var _curve_animation: AnimationPlayer = %CurveAnimation
|
|
@onready var _power_animation: AnimationPlayer = %PowerAnimation
|
|
|
|
@onready var _nice_animation: AnimationPlayer = %NiceAnimation
|
|
@onready var _wasted_animation: AnimationPlayer = %WastedAnimation
|
|
|
|
@onready var _state: AnimationNodeStateMachinePlayback = hud_state_machine["parameters/playback"]
|
|
|
|
|
|
## Set any HUD state specific to the player.
|
|
func set_state_for_player(player: WorldPlayer) -> void:
|
|
print_debug("Setting HUD for player ", player.name)
|
|
club_selector.set_state_for_player(player)
|
|
# TODO life
|
|
# TODO special equipment
|
|
# TODO abilities
|
|
|
|
|
|
func show_hud() -> void:
|
|
_state.travel("visible")
|
|
|
|
|
|
func hide_hud() -> void:
|
|
_state.travel("hidden")
|
|
|
|
|
|
func start_power_bar() -> void:
|
|
_power_animation.play("fill")
|
|
|
|
|
|
func stop_power_bar() -> void:
|
|
_power_animation.pause()
|
|
|
|
|
|
func reset_power_bar() -> void:
|
|
_power_animation.stop()
|
|
|
|
|
|
func start_curve_bar() -> void:
|
|
_curve_animation.play("fill")
|
|
|
|
|
|
func stop_curve_bar() -> void:
|
|
_curve_animation.pause()
|
|
|
|
|
|
func reset_curve_bar() -> void:
|
|
_curve_animation.stop()
|
|
|
|
|
|
func play_nice_animation() -> void:
|
|
_nice_animation.play("display")
|
|
|
|
|
|
func play_wasted_animation() -> void:
|
|
_wasted_animation.play("display")
|