diff options
Diffstat (limited to 'scripts/ui_panel.gd')
-rw-r--r-- | scripts/ui_panel.gd | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/scripts/ui_panel.gd b/scripts/ui_panel.gd index 6d3ea5a..d28812b 100644 --- a/scripts/ui_panel.gd +++ b/scripts/ui_panel.gd @@ -12,3 +12,15 @@ func _ready(): $HBoxContainer/Texture.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED $HBoxContainer/VBoxContainer/Label.text = desc $HBoxContainer/VBoxContainer/Label2.text = str(cost) + print(get_theme_stylebox("panel").bg_color) + $ColorRect.color = get_theme_stylebox("panel").bg_color + $ColorRect.modulate.a = 0.0 + + GameData.connect("life_changed", Callable(self, "_update_affordability")) + _update_affordability() + +func _update_affordability(): + if (GameData.get_life() >= cost): + $ColorRect.modulate.a = 0.0 + else: + $ColorRect.modulate.a = 0.75 |