// Use this for initialization void Start() { btn = GetComponent <Button> (); btn.onClick.AddListener(OpenP1DG); // Disable if not unlocked from shop ShopUnlocked SU = GameObject.FindGameObjectWithTag("ShopUnlocked").GetComponent <ShopUnlocked>(); // Casino upgrade is 3 if (SU.CheckUpgrades(6) < 1) { Destroy(transform.parent.gameObject); } }
// Use this for initialization void Start() { Button btn = GetComponent <Button> (); btn.onClick.AddListener(ChangeScene); // Disable if not unlocked from shop ShopUnlocked SU = GameObject.FindGameObjectWithTag("ShopUnlocked").GetComponent <ShopUnlocked>(); // Retro upgrade is 5 if (SU.CheckUpgrades(5) < 1) { Destroy(transform.parent.gameObject); } }
void SetupUpgrades() { // Find Upgrades GameObject Upgrades = GameObject.FindGameObjectWithTag("Upgrades").gameObject; // prices List <int> prices = new List <int> { 99, 499, 999, 299, 399, 109, 394, 808, 2048 }; // DestroyAlreadyUpgraded for (int i = 0; i < Upgrades.transform.childCount; i++) { // set index and price UpgradeList.Add(Upgrades.transform.GetChild(i).gameObject); Upgrades.transform.GetChild(i).transform.GetChild(0).GetComponent <ShopButtonClick> ().setIndexAndPrice(i, prices[i]); if (SU.CheckUpgrades(i) == 1) { Debug.Log("already bought " + i); Destroy(UpgradeList[i]); } } }