public void UpgradeScreen(string objectSelected, Popup_Controller popupController) { for (int i = 0; i < screenObjectList.Count; i++) { if (screenObjectList[i].name.Equals(objectSelected)) { ScreenObject theScreen = screenObjectList[i].GetComponent<Screen_Script>().theScreen; if (theScreen.GetUpgradeLevel() < 4 && !theScreen.ConstructionInProgress()) { ConfirmationScript.OptionSelected(3, new string[] { "upgrade Screen " + theScreen.GetScreenNumber(), (theScreen.CalculateUpgradeCost()).ToString(), "0", i.ToString() }, "This will cost: "); break; } else if (theScreen.ConstructionInProgress()) { popupController.ShowPopup(3, "Construction on this Screen is already in progress!"); } else { popupController.ShowPopup(3, "This Screen is already fully upgraded!"); } } } }
// Use this for initialization void Start() { mainController = GameObject.Find("Central Controller").GetComponent<Controller>(); popupController = GameObject.Find("PopupController").GetComponent<Popup_Controller>(); }
// runs once at startup of script void Start() { // set up all variables mainController = GameObject.Find("Central Controller").GetComponent<Controller>(); shopController = GameObject.Find("ShopController").GetComponent<ShopController>(); popupController = GameObject.Find("PopupController").GetComponent<Popup_Controller>(); financeController = GameObject.Find("FinanceController").GetComponent<Finance_Controller>(); theConfirmPanel = popupController.confirmationPanel; textElements = theConfirmPanel.GetComponentsInChildren<Text>(); imageElements = theConfirmPanel.GetComponentsInChildren<Image>(); }