fixes
This commit is contained in:
parent
470aeff3f3
commit
d2c90c3b7f
3 changed files with 10 additions and 7 deletions
|
|
@ -29,6 +29,7 @@ public class Inventory : MonoBehaviour {
|
|||
}
|
||||
|
||||
public void tempAddItem(Item item) {
|
||||
Debug.Log("AWSD");
|
||||
AddItem(item, 1);
|
||||
}
|
||||
|
||||
|
|
@ -38,13 +39,15 @@ public class Inventory : MonoBehaviour {
|
|||
return;
|
||||
}
|
||||
|
||||
Debug.Log("ASDADADWDASDWD");
|
||||
|
||||
if(!items.ContainsKey(item)) {
|
||||
items.Add(item, amount);
|
||||
} else {
|
||||
items[item] += amount;
|
||||
}
|
||||
|
||||
|
||||
|
||||
onItemChangedCallback?.Invoke();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ public class PlayerController : MonoBehaviour {
|
|||
|
||||
#endregion
|
||||
|
||||
public Inventory inventory;
|
||||
private Inventory _inventory;
|
||||
private int money;
|
||||
private UsableItem selectedItem;
|
||||
|
||||
|
|
@ -29,13 +29,14 @@ public class PlayerController : MonoBehaviour {
|
|||
// Start is called before the first frame update
|
||||
void Start() {
|
||||
money = startMoney;
|
||||
_inventory = Inventory.instance;
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update() { }
|
||||
|
||||
public void SetSelectedItem(UsableItem item) {
|
||||
if(inventory.items.ContainsKey(item)) {
|
||||
if(_inventory.items.ContainsKey(item)) {
|
||||
selectedItem = item;
|
||||
Cursor.SetCursor(item.defaultSprite.texture, Vector2.zero, CursorMode.Auto);
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue