// This method upgrades the current lvl to the prefab passed into it public void UpgradeToDifferentLvl(GameObject newLvlPrefab, ApartmentUpgrade UIToUpdate) { //Check whether we have enough money to upgrade to this apartment if (miningController.myMiningController.currentBalance > UIToUpdate.myApartment.myPrice) { //Collect the numbers from the existing apartment CollectData(); //Spawn the new apartment into the scene in the same position as the old one SpawnNewApartment(newLvlPrefab); //Assigning the numbers and spawning the same amount of items as in the previous apartment AssignDataAndSpawnItems(); //Delete the old apartment DeleteOldApartment(); PropogateNewMap(); //Setting the new lvl data to the current lvl data currentLvlData = newLvlData; newLvlData = null; // Run the upgraded apartment delegate upgradedApartment(UIToUpdate); levelUpgradedEvent.Raise(); } return; }
void RefreshApartmentPurchaseUI(ApartmentUpgrade UItoUpdate) { if (this == UItoUpdate) { active = false; current = true; darkOverlay.gameObject.SetActive(true); alreadyOwnedText.gameObject.SetActive(true); buyButton.GetComponentInChildren <TextMeshProUGUI>().text = "..."; buyButton.interactable = false; buyButton.GetComponent <Image>().color = Color.gray; } else { if (this.orderNumber < UItoUpdate.orderNumber) { active = false; current = false; darkOverlay.gameObject.SetActive(true); alreadyOwnedText.gameObject.SetActive(false); buyButton.GetComponentInChildren <TextMeshProUGUI>().text = "..."; buyButton.GetComponent <Image>().color = Color.gray; } // Checking whether this is a current apartment if (current) { current = false; alreadyOwnedText.gameObject.SetActive(false); } buyButton.GetComponent <Image>().color = Color.gray; } }