summaryrefslogtreecommitdiff
path: root/Assembly_CSharp/TowerUnlockManager.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Assembly_CSharp/TowerUnlockManager.cs')
-rw-r--r--Assembly_CSharp/TowerUnlockManager.cs54
1 files changed, 54 insertions, 0 deletions
diff --git a/Assembly_CSharp/TowerUnlockManager.cs b/Assembly_CSharp/TowerUnlockManager.cs
new file mode 100644
index 0000000..d96b9d5
--- /dev/null
+++ b/Assembly_CSharp/TowerUnlockManager.cs
@@ -0,0 +1,54 @@
+using System.Collections.Generic;
+using UnityEngine;
+
+public class TowerUnlockManager : MonoBehaviour
+{
+ public static TowerUnlockManager instance;
+
+ [SerializeField]
+ private List<GameObject> unlockedTowers = new List<GameObject>();
+
+ [SerializeField]
+ private List<GameObject> unlockedBuildings = new List<GameObject>();
+
+ private void Awake()
+ {
+ instance = this;
+ }
+
+ private void Start()
+ {
+ DisplayButtons();
+ }
+
+ public void UnlockTower(GameObject towerUIObject, bool isTower)
+ {
+ towerUIObject.SetActive(value: true);
+ if (isTower)
+ {
+ unlockedTowers.Add(towerUIObject);
+ }
+ else
+ {
+ unlockedBuildings.Add(towerUIObject);
+ }
+ DisplayButtons();
+ }
+
+ private void DisplayButtons()
+ {
+ int num = 0;
+ int num2 = ((unlockedBuildings.Count > 0) ? 1 : 0);
+ foreach (GameObject unlockedTower in unlockedTowers)
+ {
+ unlockedTower.transform.localPosition = new Vector3(num * 100 - unlockedTowers.Count * 50 + 50, 100 * num2, 0f);
+ num++;
+ }
+ num = 0;
+ foreach (GameObject unlockedBuilding in unlockedBuildings)
+ {
+ unlockedBuilding.transform.localPosition = new Vector3(num * 100 - unlockedBuildings.Count * 50 + 50, 0f, 0f);
+ num++;
+ }
+ }
+}