diff --git a/Assets/Scenes/UpgradesScene.unity b/Assets/Scenes/UpgradesScene.unity index de3a630..b8f9dc3 100644 --- a/Assets/Scenes/UpgradesScene.unity +++ b/Assets/Scenes/UpgradesScene.unity @@ -324,9 +324,9 @@ MonoBehaviour: m_ColorMultiplier: 1 m_FadeDuration: 0.1 m_SpriteState: - m_HighlightedSprite: {fileID: 21300000, guid: e76da6b4d6427e84097b6d764b9a91bf, + m_HighlightedSprite: {fileID: 21300000, guid: 451e6df5541d3f4498972852b96985a0, type: 3} - m_PressedSprite: {fileID: 21300000, guid: e76da6b4d6427e84097b6d764b9a91bf, type: 3} + m_PressedSprite: {fileID: 21300000, guid: 451e6df5541d3f4498972852b96985a0, type: 3} m_SelectedSprite: {fileID: 21300000, guid: fd64923844b14084ead7988cb85f3f18, type: 3} m_DisabledSprite: {fileID: 21300000, guid: fd64923844b14084ead7988cb85f3f18, type: 3} m_AnimationTriggers: @@ -465,9 +465,9 @@ MonoBehaviour: m_ColorMultiplier: 1 m_FadeDuration: 0.1 m_SpriteState: - m_HighlightedSprite: {fileID: 21300000, guid: e76da6b4d6427e84097b6d764b9a91bf, + m_HighlightedSprite: {fileID: 21300000, guid: 451e6df5541d3f4498972852b96985a0, type: 3} - m_PressedSprite: {fileID: 21300000, guid: e76da6b4d6427e84097b6d764b9a91bf, type: 3} + m_PressedSprite: {fileID: 21300000, guid: 451e6df5541d3f4498972852b96985a0, type: 3} m_SelectedSprite: {fileID: 21300000, guid: fd64923844b14084ead7988cb85f3f18, type: 3} m_DisabledSprite: {fileID: 21300000, guid: fd64923844b14084ead7988cb85f3f18, type: 3} m_AnimationTriggers: @@ -2933,9 +2933,9 @@ MonoBehaviour: m_ColorMultiplier: 1 m_FadeDuration: 0.1 m_SpriteState: - m_HighlightedSprite: {fileID: 21300000, guid: e76da6b4d6427e84097b6d764b9a91bf, + m_HighlightedSprite: {fileID: 21300000, guid: 451e6df5541d3f4498972852b96985a0, type: 3} - m_PressedSprite: {fileID: 21300000, guid: e76da6b4d6427e84097b6d764b9a91bf, type: 3} + m_PressedSprite: {fileID: 21300000, guid: 451e6df5541d3f4498972852b96985a0, type: 3} m_SelectedSprite: {fileID: 21300000, guid: fd64923844b14084ead7988cb85f3f18, type: 3} m_DisabledSprite: {fileID: 21300000, guid: fd64923844b14084ead7988cb85f3f18, type: 3} m_AnimationTriggers: @@ -3539,9 +3539,9 @@ MonoBehaviour: m_ColorMultiplier: 1 m_FadeDuration: 0.1 m_SpriteState: - m_HighlightedSprite: {fileID: 21300000, guid: e76da6b4d6427e84097b6d764b9a91bf, + m_HighlightedSprite: {fileID: 21300000, guid: 451e6df5541d3f4498972852b96985a0, type: 3} - m_PressedSprite: {fileID: 21300000, guid: e76da6b4d6427e84097b6d764b9a91bf, type: 3} + m_PressedSprite: {fileID: 21300000, guid: 451e6df5541d3f4498972852b96985a0, type: 3} m_SelectedSprite: {fileID: 21300000, guid: fd64923844b14084ead7988cb85f3f18, type: 3} m_DisabledSprite: {fileID: 21300000, guid: fd64923844b14084ead7988cb85f3f18, type: 3} m_AnimationTriggers: @@ -5387,9 +5387,9 @@ MonoBehaviour: m_ColorMultiplier: 1 m_FadeDuration: 0.1 m_SpriteState: - m_HighlightedSprite: {fileID: 21300000, guid: e76da6b4d6427e84097b6d764b9a91bf, + m_HighlightedSprite: {fileID: 21300000, guid: 451e6df5541d3f4498972852b96985a0, type: 3} - m_PressedSprite: {fileID: 21300000, guid: e76da6b4d6427e84097b6d764b9a91bf, type: 3} + m_PressedSprite: {fileID: 21300000, guid: 451e6df5541d3f4498972852b96985a0, type: 3} m_SelectedSprite: {fileID: 21300000, guid: fd64923844b14084ead7988cb85f3f18, type: 3} m_DisabledSprite: {fileID: 21300000, guid: fd64923844b14084ead7988cb85f3f18, type: 3} m_AnimationTriggers: @@ -6187,9 +6187,9 @@ MonoBehaviour: m_ColorMultiplier: 1 m_FadeDuration: 0.1 m_SpriteState: - m_HighlightedSprite: {fileID: 21300000, guid: e76da6b4d6427e84097b6d764b9a91bf, + m_HighlightedSprite: {fileID: 21300000, guid: 451e6df5541d3f4498972852b96985a0, type: 3} - m_PressedSprite: {fileID: 21300000, guid: e76da6b4d6427e84097b6d764b9a91bf, type: 3} + m_PressedSprite: {fileID: 21300000, guid: 451e6df5541d3f4498972852b96985a0, type: 3} m_SelectedSprite: {fileID: 21300000, guid: fd64923844b14084ead7988cb85f3f18, type: 3} m_DisabledSprite: {fileID: 21300000, guid: fd64923844b14084ead7988cb85f3f18, type: 3} m_AnimationTriggers: @@ -6649,9 +6649,9 @@ MonoBehaviour: m_ColorMultiplier: 1 m_FadeDuration: 0.1 m_SpriteState: - m_HighlightedSprite: {fileID: 21300000, guid: e76da6b4d6427e84097b6d764b9a91bf, + m_HighlightedSprite: {fileID: 21300000, guid: 451e6df5541d3f4498972852b96985a0, type: 3} - m_PressedSprite: {fileID: 21300000, guid: e76da6b4d6427e84097b6d764b9a91bf, type: 3} + m_PressedSprite: {fileID: 21300000, guid: 451e6df5541d3f4498972852b96985a0, type: 3} m_SelectedSprite: {fileID: 21300000, guid: fd64923844b14084ead7988cb85f3f18, type: 3} m_DisabledSprite: {fileID: 21300000, guid: fd64923844b14084ead7988cb85f3f18, type: 3} m_AnimationTriggers: @@ -12553,9 +12553,9 @@ MonoBehaviour: m_ColorMultiplier: 1 m_FadeDuration: 0.1 m_SpriteState: - m_HighlightedSprite: {fileID: 21300000, guid: e76da6b4d6427e84097b6d764b9a91bf, + m_HighlightedSprite: {fileID: 21300000, guid: 451e6df5541d3f4498972852b96985a0, type: 3} - m_PressedSprite: {fileID: 21300000, guid: e76da6b4d6427e84097b6d764b9a91bf, type: 3} + m_PressedSprite: {fileID: 21300000, guid: 451e6df5541d3f4498972852b96985a0, type: 3} m_SelectedSprite: {fileID: 21300000, guid: fd64923844b14084ead7988cb85f3f18, type: 3} m_DisabledSprite: {fileID: 21300000, guid: fd64923844b14084ead7988cb85f3f18, type: 3} m_AnimationTriggers: diff --git a/Assets/Scripts/Game/UpgradeManager.cs b/Assets/Scripts/Game/UpgradeManager.cs index 84d4209..9052cbe 100644 --- a/Assets/Scripts/Game/UpgradeManager.cs +++ b/Assets/Scripts/Game/UpgradeManager.cs @@ -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 } diff --git a/Assets/Scripts/UI/BuildingUnlockButton.cs b/Assets/Scripts/UI/BuildingUnlockButton.cs index 66494b5..99cb0c9 100644 --- a/Assets/Scripts/UI/BuildingUnlockButton.cs +++ b/Assets/Scripts/UI/BuildingUnlockButton.cs @@ -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);