fixed SelectedItem when no item

This commit is contained in:
j-weissen 2022-06-09 09:27:35 +02:00
parent 8e64a009f5
commit 93809f5052
3 changed files with 24 additions and 6 deletions

View file

@ -35,6 +35,15 @@ public class Inventory : ItemStorage {
base.AddItem(item, amount);
}
public override void RemoveItem(Item item, int amount)
{
base.RemoveItem(item, amount);
if (!items.ContainsKey(item))
{
PlayerController.instance.DeselectItem();
}
}
public void SellItem(Item item, int amount) {
PlayerController.instance.ChangeMoney(item.SellPrice);
Shop.instance.AddItem(item, amount);