Added the unlock menu thing

This commit is contained in:
Pasha Bibko
2026-05-05 11:21:44 +01:00
parent 4b08904de9
commit 066b3bc958
6 changed files with 934 additions and 69 deletions

View File

@@ -106,20 +106,15 @@ namespace Fruitomation.UI
UpgradeLines = lines.ToArray();
}
private void OnButtonClicked()
{
if (Cost == 0f)
{
Debug.LogWarning("Upgrade Cost has not been set");
return;
}
if (MoneyController.CanBuy(Cost))
{
UpgradeManager.Unlock(Upgrade);
}
}
private void OnButtonClicked() => UpgradeBoard.Enable
(
Upgrade,
Inputs,
Outputs,
Building,
Cost
);
private bool IsUnlockable =>
RequiredUpgrades.Length == 0 ||
RequiredUpgrades.All(required => required.IsUnlocked);
@@ -170,7 +165,8 @@ namespace Fruitomation.UI
State = UpgradeState.Hidden;
}
AttachedButton.interactable = State == UpgradeState.Unlockable;
AttachedButton.interactable =
State is UpgradeState.Unlockable or UpgradeState.Unlocked;
string cost = Cost == 0f ? "UNAVAILABLE" : $"{Cost:F1}";