private void Update() { //Detects if they have reached the final upgrade: if (currentUpgradeIndex == upgrades.Count) { return; } //Detects if the nextUpgrade is possible based on amount of money left: if (upgrades[currentUpgradeIndex].UpgradeCost > GameManager.instance.Coins) { return; } //If it is possible, set the Text the have the next upgrade name: currentUpgrade = upgrades[currentUpgradeIndex]; if (SettingsHelper.CurrentControlMode == SettingsHelper.ControlMode.MobileInput) { upgradeText.text = $"Upgrade Available: {currentUpgrade.UpgradeName}"; upgradeButton.gameObject.SetActive(true); } else { upgradeText.text = $"Press E to Upgrade: {currentUpgrade.UpgradeName}"; if (Input.GetKeyDown(KeyCode.E)) { ApplyUpgrade(); } } }
private void Start() { //Sets HUD to be a blank, since no upgrades are purchasable: upgradeText.text = string.Empty; //Finds the only playShip object based on Firebullets script: playerShip = FindObjectOfType <FireBullets>(); //Applies first upgrade to ship: currentUpgrade = upgrades[currentUpgradeIndex]; ApplyUpgrade(); upgradeButton.gameObject.SetActive(false); }