diff --git a/Assets/Scripts/Item/InventoryManager.cs b/Assets/Scripts/Item/InventoryManager.cs new file mode 100644 index 0000000..25813ef --- /dev/null +++ b/Assets/Scripts/Item/InventoryManager.cs @@ -0,0 +1,23 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class InventoryManager : MonoBehaviour +{ + public static InventoryManager Instance; + public List Items = new List(); + private void Awake() + { + Instance = this; + } + + public void Add(Item item) + { + Items.Add(item); + } + + public void Remove(Item item) + { + Items.Remove(item); + } +} diff --git a/Assets/Scripts/Item/InventoryManager.cs.meta b/Assets/Scripts/Item/InventoryManager.cs.meta new file mode 100644 index 0000000..2344fc0 --- /dev/null +++ b/Assets/Scripts/Item/InventoryManager.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8f3acbbbd8d0c6f46a3224a980c464b7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Item/Item.cs b/Assets/Scripts/Item/Item.cs new file mode 100644 index 0000000..99245c9 --- /dev/null +++ b/Assets/Scripts/Item/Item.cs @@ -0,0 +1,12 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +[CreateAssetMenu(fileName = "New Item", menuName = "Item/Create New Item")] +public class Item : ScriptableObject +{ + public int id; + public string itemName; + public int value; + public Sprite icon; +} diff --git a/Assets/Scripts/Item/Item.cs.meta b/Assets/Scripts/Item/Item.cs.meta new file mode 100644 index 0000000..e11b963 --- /dev/null +++ b/Assets/Scripts/Item/Item.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9754da0159a13914fa2cca8dfd8947b6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Item/ItemController.cs b/Assets/Scripts/Item/ItemController.cs new file mode 100644 index 0000000..27a0186 --- /dev/null +++ b/Assets/Scripts/Item/ItemController.cs @@ -0,0 +1,8 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class ItemController : MonoBehaviour +{ + public Item Item; +} diff --git a/Assets/Scripts/Item/ItemController.cs.meta b/Assets/Scripts/Item/ItemController.cs.meta new file mode 100644 index 0000000..c6e557d --- /dev/null +++ b/Assets/Scripts/Item/ItemController.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 189450a37ebd7b644b57861926800291 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Item/ItemPickup.cs b/Assets/Scripts/Item/ItemPickup.cs new file mode 100644 index 0000000..5e4ab43 --- /dev/null +++ b/Assets/Scripts/Item/ItemPickup.cs @@ -0,0 +1,19 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class ItemPickup : MonoBehaviour +{ + public Item Item; + void Pickup() + { + InventoryManager.Instance.Add(Item); + Destroy(gameObject); + } + + + private void OnMouseDown() + { + Pickup(); + } +} diff --git a/Assets/Scripts/Item/ItemPickup.cs.meta b/Assets/Scripts/Item/ItemPickup.cs.meta new file mode 100644 index 0000000..2d576a4 --- /dev/null +++ b/Assets/Scripts/Item/ItemPickup.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a55465ca61829c74497115ede3695c05 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: