diff options
Diffstat (limited to 'scripts/ui_panel.gd')
-rw-r--r-- | scripts/ui_panel.gd | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/scripts/ui_panel.gd b/scripts/ui_panel.gd index 3786410..e32115c 100644 --- a/scripts/ui_panel.gd +++ b/scripts/ui_panel.gd @@ -4,6 +4,7 @@ extends Panel @export var desc: String @export var cost: int +@export var is_valid : bool @export var sprite_atlas : Vector2i func _ready(): @@ -11,7 +12,7 @@ func _ready(): $HBoxContainer/Texture.texture = texture $HBoxContainer/Texture.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED $HBoxContainer/VBoxContainer/Label.text = desc - $HBoxContainer/VBoxContainer/Label2.text = str(cost) + $HBoxContainer/VBoxContainer/Label2.text = str(cost) if is_valid else "-" $ColorRect.color = get_theme_stylebox("panel").bg_color $ColorRect.modulate.a = 0.0 @@ -19,7 +20,7 @@ func _ready(): _update_affordability() func _update_affordability(): - if (GameData.get_life() >= cost): + if (GameData.get_life() >= cost && is_valid): $ColorRect.modulate.a = 0.0 else: $ColorRect.modulate.a = 0.75 |