Skip to content
Snippets Groups Projects
Commit 6459e572 authored by Timothy Stanley's avatar Timothy Stanley
Browse files

chore: change function name, doubled price after upgrade

parent b2c7623f
Branches
Tags
No related merge requests found
......@@ -81,7 +81,7 @@ public class PlayerWeapon : MonoBehaviour, IDataPersistence
currentWeapon = weapons[currentWeaponIndex];
}
public void UpgradeIten(int i)
public void UpgradeItem(int i)
{
Debug.Log(weaponFires[i].name);
if (weaponFires[i].name == "GunBarrelEnd") weaponFires[i].GetComponent<PlayerShooting>().Upgrade();
......
......@@ -137,15 +137,20 @@ public class ShopManager : MonoBehaviour, IDataPersistence {
GameObject buttonRef = GameObject.FindGameObjectWithTag("Event").GetComponent<EventSystem>().currentSelectedGameObject;
int itemID = buttonRef.GetComponent<ButtonInfo>().ItemID;
Text itemName = buttonRef.GetComponent<ButtonInfo>().ItemName;
if (money >= upgradeWeapon[2, itemID] && upgradeWeapon[3, itemID] <= 3)
{
money -= upgradeWeapon[2, itemID];
moneyText.text = "$ " + money.ToString();
playerInfo.DecreaseMoney(upgradeWeapon[2, itemID]);
upgradeWeapon[2, itemID] *= 2;
upgradeWeapon[3, itemID] += 1;
playerWeapon.UpgradeIten(itemID - 1);
playerWeapon.UpgradeItem(itemID - 1);
itemName.text = itemName.text.Split("-")[0] + "-" + upgradeWeapon[2, itemID];
for (int i = 0; i < upgradeWeapon[3, itemID]; i++)
{
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment