35 lines
1.1 KiB
GDScript
35 lines
1.1 KiB
GDScript
class_name Workbench
|
|
extends Node3D
|
|
## The work area's tool table, where the scarecrow buys upgrades (Upgrades, UpgradePanel): press
|
|
## interact here by day to open the menu. Its label shows how many are done.
|
|
|
|
## How close the scarecrow's center has to be to this node's origin.
|
|
@export var reach: float = 2.2
|
|
|
|
var _label: Label3D
|
|
|
|
|
|
func _ready() -> void:
|
|
_label = Label3D.new()
|
|
_label.billboard = BaseMaterial3D.BILLBOARD_ENABLED
|
|
_label.no_depth_test = true
|
|
_label.shaded = false
|
|
_label.font_size = 40
|
|
_label.outline_size = 10
|
|
_label.pixel_size = 0.0075
|
|
_label.modulate = Color(0.85, 0.75, 1.0)
|
|
_label.position = Vector3(0.0, 2.2, 0.0)
|
|
_label.visible = false
|
|
add_child(_label)
|
|
|
|
|
|
func show_state(campaign: CampaignController, show: bool, focused: bool) -> void:
|
|
_label.visible = show
|
|
if not show:
|
|
return
|
|
var done := 0
|
|
for id in Upgrades.ORDER:
|
|
if Upgrades.owned(campaign.state, id):
|
|
done += 1
|
|
var hint := ("[E / X] Upgrades" if campaign.is_daytime() else "Upgrades by day") if focused else "Upgrades"
|
|
_label.text = "%s\n%d of %d done" % [hint, done, Upgrades.ORDER.size()]
|