you can now sell Items with Right Mouse Click on an InventorySlot for the Item.SellPrice

and it gets put into the Shop for full price

renamed Item.cost to Item.price
This commit is contained in:
d-hain 2022-06-08 22:52:28 +02:00
parent 64b25a2029
commit ba9be3d96b
7 changed files with 50 additions and 13 deletions

View file

@ -25,7 +25,7 @@ public class PlayerController : MonoBehaviour {
private int _money;
private UsableItem _selectedItem;
public int startMoney = 100;
public int startMoney;
public TextMeshProUGUI moneyTextMeshProUGUI;
public int Money => _money;
@ -35,8 +35,9 @@ public class PlayerController : MonoBehaviour {
// Start is called before the first frame update
private void Start() {
_money = startMoney;
_inventory = Inventory.instance;
_money = startMoney;
UpdateMoneyUI();
onMoneyChangedCallback += UpdateMoneyUI;
}
@ -56,6 +57,7 @@ public class PlayerController : MonoBehaviour {
public void ChangeMoney(int amount) {
_money += amount;
onMoneyChangedCallback?.Invoke();
}