feat(dolphin): swim controller + third-person camera + HUD stats

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Floppyrj45
2026-04-19 17:07:08 +02:00
parent 1c1ff67d88
commit b004a65e96
5 changed files with 594 additions and 1 deletions

39
scripts/dolphin/HUD.gd Normal file
View File

@@ -0,0 +1,39 @@
extends CanvasLayer
@onready var _oxygen_bar: ProgressBar = %OxygenBar
@onready var _health_bar: ProgressBar = %HealthBar
@onready var _hunger_bar: ProgressBar = %HungerBar
func _ready() -> void:
_style_bar(_oxygen_bar, Color(0.31, 0.76, 0.97))
_style_bar(_health_bar, Color(0.91, 0.30, 0.24))
_style_bar(_hunger_bar, Color(0.95, 0.61, 0.07))
func _style_bar(bar: ProgressBar, color: Color) -> void:
var style := StyleBoxFlat.new()
style.bg_color = color
style.corner_radius_top_left = 4
style.corner_radius_top_right = 4
style.corner_radius_bottom_left = 4
style.corner_radius_bottom_right = 4
bar.add_theme_stylebox_override("fill", style)
var bg_style := StyleBoxFlat.new()
bg_style.bg_color = Color(0.1, 0.1, 0.1, 0.6)
bg_style.corner_radius_top_left = 4
bg_style.corner_radius_top_right = 4
bg_style.corner_radius_bottom_left = 4
bg_style.corner_radius_bottom_right = 4
bar.add_theme_stylebox_override("background", bg_style)
func connect_to_dolphin(dolphin: CharacterBody3D) -> void:
dolphin.stats_changed.connect(_on_stats_changed)
func _on_stats_changed(oxygen: float, hp: float, hunger: float) -> void:
_oxygen_bar.value = oxygen
_health_bar.value = hp
_hunger_bar.value = hunger