public void BuyProjectile(int index) { StoreItem item = items[index]; int ammoPrice = item.projectilePrefab.GetComponent <Projectile>().price; if (GameManager.instance.score >= ammoPrice) { item.BuyItem(); if (player.projectilePrefab == null) { player.projectilePrefab = item.projectilePrefab; player.timeBetweenShots = item.projectilePrefab.GetComponent <Projectile>().timeBetweenShots; Text equipText = item.whenOwnedUI.GetComponentInChildren <Button>().GetComponentInChildren <Text>(); equipText.text = "equipped"; } GameManager.instance.ChangeScore(-ammoPrice, true); float multiplier = ((int)item.weaponLevel + 1) * item.projectilePrefab.GetComponent <Projectile>().priceMultiplier; int upgradePrice = (int)(item.projectilePrefab.GetComponent <Projectile>().price *multiplier); if (GameManager.instance.score < upgradePrice) { Button upgradeButton = item.whenOwnedUI.GetComponentsInChildren <Button>()[1]; upgradeButton.interactable = false; } } }