Did stuff
This commit is contained in:
@@ -186,7 +186,10 @@ namespace Fruitomation.Game
|
||||
|
||||
#if UNITY_EDITOR
|
||||
[MenuItem("Fruitomation/Reset Upgrades")]
|
||||
public static void ResetUpgrades() => CurrentUpgrades = new UnlockedUpgrades();
|
||||
public static void ResetUpgrades()
|
||||
{
|
||||
CurrentUpgrades = new UnlockedUpgrades();
|
||||
}
|
||||
|
||||
[MenuItem("Fruitomation/Unlock All Upgrades")]
|
||||
public static void UnlockAll()
|
||||
@@ -198,6 +201,15 @@ namespace Fruitomation.Game
|
||||
{
|
||||
Unlock(upgrade);
|
||||
}
|
||||
|
||||
BuildingUnlock[] unlocks = Enum.GetValues(typeof(BuildingUnlock)) as BuildingUnlock[];
|
||||
System.Diagnostics.Debug.Assert(unlocks != null, nameof(unlocks) + " != null");
|
||||
|
||||
foreach (BuildingUnlock unlock in unlocks)
|
||||
{
|
||||
if (unlock != BuildingUnlock.None)
|
||||
Unlock(unlock);
|
||||
}
|
||||
}
|
||||
#endif // UNITY_EDITOR
|
||||
}
|
||||
|
||||
@@ -23,6 +23,18 @@ namespace Fruitomation.UI
|
||||
AttachedButton.onClick.AddListener(OnButtonClicked);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
string formatted = Regex.Replace(Building.ToString(), "[A-Z]", " $0")[1..];
|
||||
bool unlocked = UpgradeManager.Is(Building);
|
||||
|
||||
AttachedText.text = unlocked
|
||||
? $"{formatted}\nUnlocked"
|
||||
: $"{formatted}\n{Cost.AsString()}";
|
||||
|
||||
AttachedButton.interactable = !unlocked;
|
||||
}
|
||||
|
||||
private void OnButtonClicked()
|
||||
{
|
||||
UpgradeManager.Unlock(Building);
|
||||
|
||||
Reference in New Issue
Block a user