extends Control

@onready var player_health_bar: TextureProgressBar = $MarginContainer/HBoxContainer/HealthBar
@onready var enemy_health_bar: TextureProgressBar = $MarginContainer/HBoxContainer/EnemyBar

func initialize(player: PlayableCharacter, enemy: AICharacter):
	player_health_bar.max_value = player.max_health
	player_health_bar.value = player.health
	enemy_health_bar.max_value = enemy.max_health
	enemy_health_bar.value = enemy.health
	
func set_player_health(value: int):
	player_health_bar.value = value

func set_enemy_health(value: int):
	enemy_health_bar.value = value
	
func set_enemy_health_visible(value: bool):
	enemy_health_bar.modulate = Color.WHITE if value else Color.TRANSPARENT

func _on_player_got_hurt(new_health: int):
	set_player_health(new_health)

func _on_enemy_got_hurt(new_health: int):
	set_enemy_health(new_health)
