public void BuyItem(Transform transform) { int indexOfButton = transform.GetSiblingIndex(); if (indexOfButton < shopList.ItemsToBuy.Length) { EquipmentObject itemToBuy = shopList.ItemsToBuy[indexOfButton]; if (inventory.BuyItem(itemToBuy, currencyID)) { currentPlayerHealth.maxRunTimeValue = currentPlayerHealth.maxRunTimeValue + (itemToBuy.defenceBonus * 2); currentPlayerHealth.runTimeValue = currentPlayerHealth.maxRunTimeValue; playerHealthObserver.Raise(); } } }