diff --git a/Assets/Scenes/MainScene.unity b/Assets/Scenes/MainScene.unity index 2fd918a..67d16c6 100644 --- a/Assets/Scenes/MainScene.unity +++ b/Assets/Scenes/MainScene.unity @@ -919,7 +919,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: -268, y: 152} + m_AnchoredPosition: {x: -385, y: 50} m_SizeDelta: {x: 100, y: 100} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &466567697 @@ -2080,7 +2080,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: -156, y: 144} + m_AnchoredPosition: {x: -388, y: 152} m_SizeDelta: {x: 100, y: 100} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1119271991 @@ -3008,7 +3008,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 1, y: 0} m_AnchorMax: {x: 1, y: 0} - m_AnchoredPosition: {x: -348, y: 107} + m_AnchoredPosition: {x: -413, y: 211} m_SizeDelta: {x: 720, y: 430} m_Pivot: {x: 0.5, y: 0.5} --- !u!1001 &1701153146 @@ -3235,7 +3235,6 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: b18feac5270242d4a85c78ce72972d56, type: 3} m_Name: m_EditorClassIdentifier: - inventory: {fileID: 1800469991} startMoney: 100 --- !u!4 &1800469990 Transform: diff --git a/Assets/Scripts/Inventory.cs b/Assets/Scripts/Inventory.cs index af84800..126196b 100644 --- a/Assets/Scripts/Inventory.cs +++ b/Assets/Scripts/Inventory.cs @@ -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(); } diff --git a/Assets/Scripts/PlayerController.cs b/Assets/Scripts/PlayerController.cs index c07d4af..12ee6ea 100644 --- a/Assets/Scripts/PlayerController.cs +++ b/Assets/Scripts/PlayerController.cs @@ -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 {