private void OnUpgrade(ShowResult result) { switch (result) { case ShowResult.Finished: if (!UpgradeSlotGUI.UpgradeInfos.IsEverythingUpgraded()) { //get random upgradeID UpgradeSlotGUI.E_UPGRADE randID = (UpgradeSlotGUI.E_UPGRADE)Random.Range(0, (int)UpgradeSlotGUI.E_UPGRADE.SIZE); while (UpgradeSlotGUI.UpgradeInfos.IsUpgradedToMax(randID)) { randID = (UpgradeSlotGUI.E_UPGRADE)Random.Range(0, (int)UpgradeSlotGUI.E_UPGRADE.SIZE); } UpgradeSlotGUI.UpgradeInfos.Upgrade(randID); if (UpgradeSlotGUI.UpgradeInfos.IsUpgradedToMax(randID)) { UpgradesGUI.refrence.DisableSlot(randID); } AudioManager.refrence.PlaySound(AudioManager.E_AUDIO.CASH); BonusText.refrence.SetText(randID + " UPGRADED TO LVL " + (UpgradeSlotGUI.UpgradeInfos.lvlsDictionary[randID])); UpgradesGUI.refrence.shopAddsContent.SetActive(false); } break; case ShowResult.Skipped: break; case ShowResult.Failed: Debug.LogError("The ad failed to be shown."); break; } }
public void DisableSlot(UpgradeSlotGUI.E_UPGRADE _upgradeType) { foreach (UpgradeSlotGUI slot in upgradeSlotList) { if (slot.upgradeType == _upgradeType) { slot.DisableSlot(); } } }