public List <AvailableComponent> GetAvailableComponents() { DispensaryManager dm = GameObject.Find("DispensaryManager").GetComponent <DispensaryManager>(); Dispensary dispensary = dm.dispensary; List <AvailableComponent> availableComponents = new List <AvailableComponent>(); int storageCount = dispensary.GetStorageCount(); if ((storageCount + 1) < dispensary.maxStorageCount) { storageCount++; availableComponents.Add(new AvailableComponent("Storage", (storageCount == 0) ? 6500 : (storageCount == 1) ? 14000 : 25000)); // Price for components where the number is limited but greater than 1 will increase with each purchase } int growCount = dispensary.GetGrowroomCount(); if ((growCount + 1) < dispensary.maxGrowroomCount) { growCount++; availableComponents.Add(new AvailableComponent("Growroom", (growCount == 0) ? 25000 : (growCount == 1) ? 60000 : 125000)); // Price for components where the number is limited but greater than 1 will increase with each purchase } int processingCount = dispensary.GetProcessingCount(); if ((processingCount + 1) < dispensary.maxProcessingCount) { processingCount++; availableComponents.Add(new AvailableComponent("Processing", (processingCount == 0) ? 25000 : (processingCount == 1) ? 60000 : 125000)); // Price for components where the number is limited but greater than 1 will increase with each purchase } int hallwayCount = dispensary.GetHallwayCount(); if ((hallwayCount + 1) < dispensary.maxHallwayCount) { hallwayCount++; availableComponents.Add(new AvailableComponent("Hallway", (hallwayCount == 0) ? 5000 : (hallwayCount == 1) ? 6000 : (hallwayCount == 2) ? 7500 : (hallwayCount == 3) ? 10000 : (hallwayCount == 4) ? 15000 : 22500)); // Price for components where the number is limited but greater than 1 will increase with each purchase } foreach (string comp in dispensary.absentComponents) { switch (comp) { case "GlassShop": availableComponents.Add(new AvailableComponent("GlassShop", 30000)); break; case "SmokeLounge": availableComponents.Add(new AvailableComponent("SmokeLounge", 10000)); break; case "Workshop": availableComponents.Add(new AvailableComponent("Workshop", 30000)); break; } } return(availableComponents); }
public void SetPurchaseButtonCallback(Button button, string component, float money) { DispensaryManager dm = GameObject.Find("DispensaryManager").GetComponent <DispensaryManager>(); Dispensary dispensary = dm.dispensary; switch (component) { case "Storage": button.onClick.AddListener(() => dm.AddStorageComponent(dispensary.GetStorageCount() + 1, money)); break; case "GlassShop": button.onClick.AddListener(() => dm.AddGlassShopComponent(money)); break; case "SmokeLounge": button.onClick.AddListener(() => dm.AddSmokeLoungeComponent(money)); break; case "Workshop": button.onClick.AddListener(() => dm.AddWorkshopComponent(money)); break; case "Growroom": button.onClick.AddListener(() => dm.AddGrowroomComponent(dispensary.GetGrowroomCount() + 1, money)); break; case "Processing": button.onClick.AddListener(() => dm.AddProcessingComponent(dispensary.GetProcessingCount() + 1, money)); break; case "Hallway": button.onClick.AddListener(() => dm.AddHallwayComponent(dispensary.GetHallwayCount() + 1, money)); break; } }