mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-28 15:01:53 +08:00
18 lines
499 B
GDScript
18 lines
499 B
GDScript
|
|
extends Node2D
|
||
|
|
class_name ObstacleStateBar
|
||
|
|
|
||
|
|
@export var obstacle: ObstacleBase
|
||
|
|
|
||
|
|
@onready var healthBar: ColorBar = $%health
|
||
|
|
@onready var currentLabel: Label = $%current
|
||
|
|
@onready var maxLabel: Label = $%max
|
||
|
|
@onready var levelLabelContainer: HBoxContainer = $%levelLabel
|
||
|
|
|
||
|
|
func forceSync():
|
||
|
|
healthBar.maxValue = obstacle.healthMax
|
||
|
|
healthBar.currentValue = obstacle.health
|
||
|
|
healthBar.forceSync()
|
||
|
|
func applyText():
|
||
|
|
currentLabel.text = "%d" % obstacle.health
|
||
|
|
maxLabel.text = "%d" % obstacle.healthMax
|