CyberTower/scripts/ui/stats_overlay.gd

26 lines
765 B
GDScript3
Raw Permalink Normal View History

2024-02-16 15:35:39 +00:00
extends Control
@export var stats: Statistics
@export var survived_indicator: Label
@export var wave_indicator: Label
@export var wave_progress: ProgressBar
var wave_stylebox = StyleBoxFlat.new()
var wave_gap_stylebox = StyleBoxFlat.new()
func _ready():
wave_stylebox.bg_color = Color("84ba7a")
wave_gap_stylebox.bg_color = Color("89a1e5")
func _process(_delta):
survived_indicator.text = "%.2fs" % (stats.get_time_survived() / 1000.0)
wave_indicator.text = "%d" % stats.get_current_wave()
if stats.in_wave_gap:
wave_progress.add_theme_stylebox_override("fill", wave_gap_stylebox)
else:
wave_progress.add_theme_stylebox_override("fill", wave_stylebox)
wave_progress.value = stats.get_current_wave_time() / stats.get_current_wave_duration() * 100