2026-01-27 20:52:26 +08:00
|
|
|
extends CanvasItem
|
2025-08-26 13:56:12 +08:00
|
|
|
class_name EntityStateBar
|
2025-08-26 09:24:09 +08:00
|
|
|
|
|
|
|
|
@export var entity: EntityBase
|
2026-04-25 13:17:17 +08:00
|
|
|
@export var longer: bool = false
|
2025-08-26 09:24:09 +08:00
|
|
|
|
2025-08-26 11:39:47 +08:00
|
|
|
@onready var healthBar: ColorBar = $"%health"
|
2025-08-28 11:00:19 +08:00
|
|
|
@onready var levelLabel: Label = $"%level"
|
2025-08-28 12:58:00 +08:00
|
|
|
@onready var levelLabels: HBoxContainer = $"%levelLabel"
|
2025-09-06 16:51:12 +08:00
|
|
|
|
2026-04-25 13:17:17 +08:00
|
|
|
func _ready():
|
|
|
|
|
if longer:
|
|
|
|
|
healthBar.size.x *= 2
|
|
|
|
|
healthBar.position.x *= 2
|
2025-09-06 16:51:12 +08:00
|
|
|
func forceSync():
|
|
|
|
|
healthBar.maxValue = entity.fields[FieldStore.Entity.MAX_HEALTH]
|
|
|
|
|
healthBar.currentValue = entity.health
|
|
|
|
|
healthBar.forceSync()
|