mirror of
				https://github.com/DerTyp7/example-top-down-unity.git
				synced 2025-10-30 21:07:09 +01:00 
			
		
		
		
	reworked inv
This commit is contained in:
		| @@ -7,4 +7,9 @@ public class FoodItem : Item | ||||
|     public int health; | ||||
|     public int water; | ||||
|     public int regeneration; | ||||
| } | ||||
|  | ||||
|     public override void OnSelect() | ||||
|     { | ||||
|         throw new System.NotImplementedException(); | ||||
|     } | ||||
| } | ||||
| @@ -1,3 +1,4 @@ | ||||
| using System; | ||||
| using System.Collections; | ||||
| using System.Collections.Generic; | ||||
| using UnityEngine; | ||||
| @@ -21,114 +22,76 @@ public class Inventory : MonoBehaviour | ||||
|     /// -------------------------------------------------------------------------------/// | ||||
|     /// </summary> | ||||
|  | ||||
|     public Item testItemType; | ||||
|  | ||||
|     public delegate void OnItemChanged(); | ||||
|     public OnItemChanged onItemChangedCallback; //  | ||||
|     public static Action OnInventoryChanged; | ||||
|     public static Action OnItemAdded; | ||||
|     public static Action OnItemRemoved; | ||||
|  | ||||
|     [Header("Inventory")] | ||||
|     [SerializeField] | ||||
|     int numberOfSlots = 20; | ||||
|  | ||||
|     [SerializeField] | ||||
|     int maxSpaceOfSlots = 10; | ||||
|  | ||||
|     [SerializeField] | ||||
|     List<Slot> inventory = new List<Slot>(); | ||||
|  | ||||
|     public List<Slot> getInventory { get => inventory;} | ||||
|     public void createEmptyInventory(int numberOfSlots, int maxSpaceOfSlots = 10)  | ||||
|     public void AddSlots(int _numberOfSlots) | ||||
|     { | ||||
|         // Initializes the inventory with a specific number of slots and slotsize. | ||||
|         // !!!Has to be called bevore adding any items!!! | ||||
|         // Example createEmptyInventory(5, 10) : 5 Slots with space for 10 items each | ||||
|         inventory = new List<Slot>(); | ||||
|         for (int i = 0; i < numberOfSlots; i++) | ||||
|         for (int i = 0; i < _numberOfSlots; i++) | ||||
|         { | ||||
|             inventory.Add(new Slot(maxSpaceOfSlots)); | ||||
|             inventory.Add(new Slot()); | ||||
|         } | ||||
|         if (onItemChangedCallback != null) | ||||
|             onItemChangedCallback.Invoke(); | ||||
|         OnInventoryChanged?.Invoke(); | ||||
|     } | ||||
|     public void addInventorySlots(int numberOfSlots, int maxSpaceOfSlots = 10) | ||||
|     Slot GetEmptySlot() | ||||
|     { | ||||
|         // Adds a specific number of slots and slotsize to the inventory. | ||||
|         // Example addInventorySlots(5, 10) : Adds 5 Slots with space for 10 items each | ||||
|         for (int i = 0; i < numberOfSlots; i++) | ||||
|         foreach (Slot slot in inventory) | ||||
|         { | ||||
|             inventory.Add(new Slot(maxSpaceOfSlots)); | ||||
|             if (slot.GetItem() == null) | ||||
|                 return slot; | ||||
|         } | ||||
|         if (onItemChangedCallback != null) | ||||
|             onItemChangedCallback.Invoke(); | ||||
|         return null; | ||||
|     } | ||||
|     public int addItemAt(int index, Item itemType,int count)  | ||||
|     Slot GetSlotByItem(Item item) | ||||
|     { | ||||
|         // Adds a number (count = 7) of items of type itemType (itemType = Stone) to an item slot(index = 3). | ||||
|         //Returns the number of items that could not be added because of unsufficent space in the specefied slot | ||||
|         //or Return -1 if the index is out of bound or the item slot is already filled with a different itemType. | ||||
|         // | ||||
|         // Example inventory.addItemAt(3,Stone,7); | ||||
|  | ||||
|         if (indexIsInRange(index) && (inventory[index].ItemType == null || inventory[index].ItemType.id == itemType.id)) | ||||
|         foreach (Slot slot in inventory) | ||||
|         { | ||||
|             if (inventory[index].ItemType == null)  | ||||
|             if (slot.GetItem() != null) | ||||
|             { | ||||
|                 inventory[index].ItemType = Instantiate(itemType); // Set the itemType if the slot was empty. | ||||
|                 if (slot.GetItem().id == item.id) | ||||
|                     return slot; | ||||
|             } | ||||
|  | ||||
|             if (inventory[index].MaxItems == inventory[index].Count)  | ||||
|             { | ||||
|  | ||||
|                 if (onItemChangedCallback != null) | ||||
|                     onItemChangedCallback.Invoke(); | ||||
|                 return count; // Can't add any items if the slot is full. | ||||
|             } | ||||
|             else if (inventory[index].MaxItems >= inventory[index].Count + count) | ||||
|             { | ||||
|                 inventory[index].addItem(count); // Adds all items if there is enought space. | ||||
|                 if(onItemChangedCallback != null) | ||||
|                     onItemChangedCallback.Invoke(); | ||||
|                 return 0; | ||||
|             } else  | ||||
|             { | ||||
|                 int rest = count - inventory[index].MaxItems - inventory[index].Count; | ||||
|                 inventory[index].addItem(inventory[index].MaxItems - inventory[index].Count); // Adds the number of items until the slot is full and returns the number of items that didn't fit. | ||||
|                 if (onItemChangedCallback != null) | ||||
|                     onItemChangedCallback.Invoke(); | ||||
|                 return rest; | ||||
|             } | ||||
|         } | ||||
|         else  | ||||
|         { | ||||
|              | ||||
|             return -1;//Wrong item or index not in range. | ||||
|         } | ||||
|         return null; | ||||
|     } | ||||
|     public int removeItemAt(int index, int count) | ||||
|     int GetRest(int count, Slot slot) | ||||
|     { | ||||
|         // Removes a number of items (count = 5)  from a specific slot (index = 4). | ||||
|         // Example inventory.removeItemAt(4,5) | ||||
|         if (indexIsInRange(index)) | ||||
|         if (CountFitsInSlot(count, slot)) | ||||
|         { | ||||
|             if (inventory[index].ItemType == null) | ||||
|             { | ||||
|                 return count;// Can't remove any items if the slot is empty. | ||||
|             } | ||||
|             else if (inventory[index].Count > count) | ||||
|             { | ||||
|                 inventory[index].removeItem(count);// Removes the number of items if there are more or equal items in the slot. | ||||
|                 return 0; | ||||
|             } | ||||
|             else if (inventory[index].Count <= count) | ||||
|             { | ||||
|                 int rest = count - inventory[index].Count; | ||||
|                 inventory[index].Count = 0; // Removes all the items from the slot  and returns the number of items that could not be removed. | ||||
|                 inventory[index].ItemType = null; // When the slot is empty the itemType can also be removed. | ||||
|                 return rest; | ||||
|             } | ||||
|             else  | ||||
|             { | ||||
|                 return -1; // Something went wrong (you should never end up in here). | ||||
|             } | ||||
|              | ||||
|             return 0; | ||||
|         } | ||||
|         else | ||||
|         { | ||||
|             return -1;//Index not in range. | ||||
|             return (count - (maxSpaceOfSlots - slot.GetCount())); | ||||
|         } | ||||
|     } | ||||
|     private bool indexIsInRange(int index) | ||||
|     bool CountFitsInSlot(int count, Slot slot) | ||||
|     { | ||||
|         int leftSize = maxSpaceOfSlots - slot.GetCount(); | ||||
|         if (leftSize > count) // left size > count | ||||
|         { | ||||
|             return true; | ||||
|         } | ||||
|         else | ||||
|         { | ||||
|             return false; | ||||
|         } | ||||
|     } | ||||
|     bool indexIsInRange(int index) | ||||
|     { | ||||
|         // Returns true if a given index is in the bounds of the inventory. | ||||
|         // Example (maxSize = 10) index = -10 : false , index =  100: false, index = 7 : true  | ||||
| @@ -142,4 +105,126 @@ public class Inventory : MonoBehaviour | ||||
|             return false; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|  | ||||
|     public int Remove(Item itemType, int count, int invIndex = -1) | ||||
|     { | ||||
|         Slot slot = null; | ||||
|  | ||||
|         Item item = Instantiate(itemType); | ||||
|         if (item == null) | ||||
|             return -1; | ||||
|  | ||||
|         // Get Slot | ||||
|         if (invIndex > -1) | ||||
|         { | ||||
|             if (indexIsInRange(invIndex)) | ||||
|                 slot = inventory[invIndex]; | ||||
|         } | ||||
|         else | ||||
|         { | ||||
|             slot = GetSlotByItem(item); | ||||
|         } | ||||
|  | ||||
|         if (slot == null) | ||||
|             return -1; | ||||
|  | ||||
|         // remove | ||||
|         if (slot.GetItem() != null && slot.GetItem().id == item.id) // Wenn im Slot schon das gleiche item ist | ||||
|         { | ||||
|             int rest = 0; | ||||
|  | ||||
|             if (slot.GetCount() >= count) | ||||
|             { | ||||
|                 slot.RemoveCount(count); | ||||
|             } | ||||
|             else | ||||
|             { | ||||
|                 rest = count - slot.GetCount(); | ||||
|                 slot.Clear(); | ||||
|             } | ||||
|             OnInventoryChanged?.Invoke(); | ||||
|             OnItemRemoved?.Invoke(); | ||||
|             return rest; | ||||
|         } | ||||
|         else | ||||
|             return -1; | ||||
|     } | ||||
|  | ||||
|     public int Add(Item itemType, int count, int invIndex = -1) | ||||
|     { | ||||
|         int rest = 0; | ||||
|         Slot slot = null; | ||||
|          | ||||
|         Item item = Instantiate(itemType); | ||||
|         if (item == null) | ||||
|             return -1; | ||||
|  | ||||
|         // Get Slot | ||||
|         if (invIndex > -1) | ||||
|         { | ||||
|             if(indexIsInRange(invIndex)) | ||||
|                 slot = inventory[invIndex]; | ||||
|         } | ||||
|         else | ||||
|         { | ||||
|             slot = GetSlotByItem(item); | ||||
|             if (slot == null) | ||||
|                 slot = GetEmptySlot(); | ||||
|         } | ||||
|  | ||||
|         if (slot == null) | ||||
|             return -1; | ||||
|  | ||||
|         // add | ||||
|         if (slot.GetItem() != null && slot.GetItem().id == item.id) // Wenn im Slot schon das selbe item ist | ||||
|         { | ||||
|             if (CountFitsInSlot(count, slot)) | ||||
|             { | ||||
|                 slot.AddCount(count); | ||||
|             } | ||||
|             else | ||||
|             { | ||||
|                 rest = GetRest(count, slot); | ||||
|                 slot.Set(item, maxSpaceOfSlots); | ||||
|             } | ||||
|         } | ||||
|         else if (slot.GetItem() == null) | ||||
|         { | ||||
|             if (CountFitsInSlot(count, slot)) | ||||
|             { | ||||
|                 slot.Set(item, count); | ||||
|             } | ||||
|             else | ||||
|             { | ||||
|                 rest = GetRest(count, slot); | ||||
|                 slot.Set(item, maxSpaceOfSlots); | ||||
|             } | ||||
|         } | ||||
|         else | ||||
|             return -1; | ||||
|  | ||||
|         OnInventoryChanged?.Invoke(); | ||||
|         OnItemAdded?.Invoke(); | ||||
|         return rest; | ||||
|     } | ||||
|  | ||||
|  | ||||
|     void Start() | ||||
|     { | ||||
|         AddSlots(numberOfSlots);         | ||||
|     } | ||||
|  | ||||
|     private void Update() | ||||
|     { | ||||
|         if (Input.GetKeyDown(KeyCode.R)) | ||||
|         { | ||||
|             Debug.Log(Add(testItemType, 8, 4)); | ||||
|         } | ||||
|  | ||||
|         if (Input.GetKeyDown(KeyCode.T)) | ||||
|         { | ||||
|             Debug.Log(Remove(testItemType, 8, 4)); | ||||
|         } | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -4,7 +4,7 @@ using UnityEngine; | ||||
|  | ||||
| public class InventoryController : MonoBehaviour | ||||
| { | ||||
|     [SerializeField] Item item1;// not needed | ||||
|     /*[SerializeField] Item item1;// not needed | ||||
|     [SerializeField] Item item2;// not needed | ||||
|     public Inventory inventory; | ||||
|     [SerializeField] UI_Inventory uiInventory; | ||||
| @@ -18,12 +18,11 @@ public class InventoryController : MonoBehaviour | ||||
|         inventory.addItemAt(3, item2, 15); | ||||
|         inventory.addItemAt(4, item1, 3); | ||||
|  | ||||
|         /* | ||||
|         Debug.Log(inventory.addItemAt(0, item2, 15)); | ||||
|         Debug.Log(inventory.getInventory[0].Count); | ||||
|         Debug.Log(inventory.removeItemAt(0, 10)); | ||||
|         Debug.Log(inventory.getInventory[0].Count); | ||||
|         */  | ||||
|          | ||||
|         uiInventory.setInventory(inventory); | ||||
|     } | ||||
|     void Start() | ||||
| @@ -35,5 +34,5 @@ public class InventoryController : MonoBehaviour | ||||
|     void Update() | ||||
|     { | ||||
|  | ||||
|     } | ||||
|     }*/ | ||||
| } | ||||
|   | ||||
| @@ -3,10 +3,20 @@ using System.Collections.Generic; | ||||
| using UnityEngine; | ||||
|  | ||||
| [CreateAssetMenu(fileName = "Item", menuName = "Items/Item", order = 1)] | ||||
| public class Item : ScriptableObject | ||||
| public abstract class Item : ScriptableObject | ||||
| { | ||||
|     public new string name; | ||||
|     public int id; | ||||
|     public bool isStackable; | ||||
|     public Sprite sprite; | ||||
| } | ||||
|  | ||||
|     public bool isSelected; | ||||
|  | ||||
|     public abstract void OnSelect(); | ||||
|  | ||||
|     public void Select() | ||||
|     { | ||||
|         isSelected = !isSelected; | ||||
|         OnSelect(); | ||||
|     } | ||||
| } | ||||
| @@ -1,18 +0,0 @@ | ||||
| %YAML 1.1 | ||||
| %TAG !u! tag:unity3d.com,2011: | ||||
| --- !u!114 &11400000 | ||||
| MonoBehaviour: | ||||
|   m_ObjectHideFlags: 0 | ||||
|   m_CorrespondingSourceObject: {fileID: 0} | ||||
|   m_PrefabInstance: {fileID: 0} | ||||
|   m_PrefabAsset: {fileID: 0} | ||||
|   m_GameObject: {fileID: 0} | ||||
|   m_Enabled: 1 | ||||
|   m_EditorHideFlags: 0 | ||||
|   m_Script: {fileID: 11500000, guid: de55e2e3081d4ee4a9d0737e718a5b3b, type: 3} | ||||
|   m_Name: Lumber | ||||
|   m_EditorClassIdentifier:  | ||||
|   name: Lumber | ||||
|   id: 3 | ||||
|   isStackable: 1 | ||||
|   sprite: {fileID: 21300000, guid: 636c61591a702914dadb6abf17d92f6f, type: 3} | ||||
| @@ -1,8 +0,0 @@ | ||||
| fileFormatVersion: 2 | ||||
| guid: 90fd8b1738596514f860a4ce5adaba88 | ||||
| NativeFormatImporter: | ||||
|   externalObjects: {} | ||||
|   mainObjectFileID: 11400000 | ||||
|   userData:  | ||||
|   assetBundleName:  | ||||
|   assetBundleVariant:  | ||||
| @@ -1,18 +0,0 @@ | ||||
| %YAML 1.1 | ||||
| %TAG !u! tag:unity3d.com,2011: | ||||
| --- !u!114 &11400000 | ||||
| MonoBehaviour: | ||||
|   m_ObjectHideFlags: 0 | ||||
|   m_CorrespondingSourceObject: {fileID: 0} | ||||
|   m_PrefabInstance: {fileID: 0} | ||||
|   m_PrefabAsset: {fileID: 0} | ||||
|   m_GameObject: {fileID: 0} | ||||
|   m_Enabled: 1 | ||||
|   m_EditorHideFlags: 0 | ||||
|   m_Script: {fileID: 11500000, guid: de55e2e3081d4ee4a9d0737e718a5b3b, type: 3} | ||||
|   m_Name: Stone | ||||
|   m_EditorClassIdentifier:  | ||||
|   name: Stone | ||||
|   id: 0 | ||||
|   isStackable: 1 | ||||
|   sprite: {fileID: 21300000, guid: 475f050511847c0499c1ca4f47fcaefa, type: 3} | ||||
| @@ -1,8 +0,0 @@ | ||||
| fileFormatVersion: 2 | ||||
| guid: e04039a6cbed5e5439b605aeee90485f | ||||
| NativeFormatImporter: | ||||
|   externalObjects: {} | ||||
|   mainObjectFileID: 11400000 | ||||
|   userData:  | ||||
|   assetBundleName:  | ||||
|   assetBundleVariant:  | ||||
| @@ -1,18 +0,0 @@ | ||||
| %YAML 1.1 | ||||
| %TAG !u! tag:unity3d.com,2011: | ||||
| --- !u!114 &11400000 | ||||
| MonoBehaviour: | ||||
|   m_ObjectHideFlags: 0 | ||||
|   m_CorrespondingSourceObject: {fileID: 0} | ||||
|   m_PrefabInstance: {fileID: 0} | ||||
|   m_PrefabAsset: {fileID: 0} | ||||
|   m_GameObject: {fileID: 0} | ||||
|   m_Enabled: 1 | ||||
|   m_EditorHideFlags: 0 | ||||
|   m_Script: {fileID: 11500000, guid: de55e2e3081d4ee4a9d0737e718a5b3b, type: 3} | ||||
|   m_Name: Wood | ||||
|   m_EditorClassIdentifier:  | ||||
|   name: Wood | ||||
|   id: 2 | ||||
|   isStackable: 1 | ||||
|   sprite: {fileID: 21300000, guid: 30728ae26107dfe438d180ab175fdaca, type: 3} | ||||
| @@ -1,8 +0,0 @@ | ||||
| fileFormatVersion: 2 | ||||
| guid: 8ac3fa2505f8292498c5c20cf4fea84d | ||||
| NativeFormatImporter: | ||||
|   externalObjects: {} | ||||
|   mainObjectFileID: 11400000 | ||||
|   userData:  | ||||
|   assetBundleName:  | ||||
|   assetBundleVariant:  | ||||
							
								
								
									
										11
									
								
								Assets/Scripts/Inventory/ResourceItem.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								Assets/Scripts/Inventory/ResourceItem.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,11 @@ | ||||
| using System.Collections; | ||||
| using System.Collections.Generic; | ||||
| using UnityEngine; | ||||
| [CreateAssetMenu(fileName = "ResourceItem", menuName = "Items/ResourceItem", order = 2)] | ||||
| public class ResourceItem : Item | ||||
| { | ||||
|     public override void OnSelect() | ||||
|     { | ||||
|         throw new System.NotImplementedException(); | ||||
|     } | ||||
| } | ||||
							
								
								
									
										11
									
								
								Assets/Scripts/Inventory/ResourceItem.cs.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								Assets/Scripts/Inventory/ResourceItem.cs.meta
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,11 @@ | ||||
| fileFormatVersion: 2 | ||||
| guid: 0fae7bba50a98204883e78d8d6c96fc2 | ||||
| MonoImporter: | ||||
|   externalObjects: {} | ||||
|   serializedVersion: 2 | ||||
|   defaultReferences: [] | ||||
|   executionOrder: 0 | ||||
|   icon: {instanceID: 0} | ||||
|   userData:  | ||||
|   assetBundleName:  | ||||
|   assetBundleVariant:  | ||||
| @@ -1,54 +1,47 @@ | ||||
| using System; | ||||
| using System.Collections; | ||||
| using System.Collections.Generic; | ||||
| using UnityEngine; | ||||
|  | ||||
| [Serializable] | ||||
| public class Slot | ||||
| { | ||||
|     /// <summary> | ||||
|     /// Holds an itemType the number of items and the number of maxItems | ||||
|     /// this has no logic so everything has to be done from the outside | ||||
|     /// [Get/Set] | ||||
|     /// ItemType | ||||
|     /// Count | ||||
|     /// MaxItems | ||||
|     /// [Methods] | ||||
|     /// void addItem(int count = 1) | ||||
|     /// void removeItem(int count = 1)  | ||||
|     /// void clear() | ||||
|     /// </summary> | ||||
|     [SerializeField] | ||||
|     Item item = null; | ||||
|  | ||||
|     Item item; | ||||
|     int maxItems = 1; | ||||
|     [SerializeField] | ||||
|     int count = 0; | ||||
|     public Item ItemType { get => item; set => item = value; } | ||||
|     public int Count { get => count; set => count = value; } | ||||
|     public int MaxItems { get => maxItems; set => maxItems = value; } | ||||
|     public Slot(int maxItems = 1) | ||||
|  | ||||
|     public Item GetItem() => item; | ||||
|  | ||||
|     public int GetCount() => count; | ||||
|     | ||||
|     public void AddCount(int value) => count += value; | ||||
|  | ||||
|     public void SetCount(int newCount) | ||||
|     { | ||||
|         item = null; | ||||
|         this.maxItems = maxItems; | ||||
|         count = newCount; | ||||
|         if (count <= 0) | ||||
|             Clear(); | ||||
|     } | ||||
|     public void addItem(int count = 1) | ||||
|  | ||||
|     public void RemoveCount(int value) | ||||
|     { | ||||
|         // adds any number of items to the slot will also go over the max items | ||||
|         this.count += count; | ||||
|         count -= value;  | ||||
|         if (count <= 0) | ||||
|             Clear(); | ||||
|     } | ||||
|     public void removeItem(int count = 1)  | ||||
|     { | ||||
|         // removes any number of items from the slot will also go negative  | ||||
|         this.count -= count; | ||||
|     } | ||||
|     public void clear() | ||||
|     public void ResetCount() => count = 0; | ||||
|  | ||||
|     public void Clear() | ||||
|     { | ||||
|         item = null; | ||||
|         count = 0; | ||||
|     } | ||||
|     public Slot copy()  | ||||
|     { | ||||
|         Slot slot = new Slot(maxItems); | ||||
|         slot.count = count; | ||||
|         slot.ItemType = ItemType; | ||||
|  | ||||
|         return slot; | ||||
|     public void Set(Item _item, int _count = 1) | ||||
|     { | ||||
|         item = _item; | ||||
|         count = _count; | ||||
|     } | ||||
| } | ||||
|   | ||||
							
								
								
									
										26
									
								
								Assets/Scripts/Inventory/ToolItem.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								Assets/Scripts/Inventory/ToolItem.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,26 @@ | ||||
| using UnityEngine; | ||||
|  | ||||
| [CreateAssetMenu(fileName = "ToolItem", menuName = "Items/Tool", order = 2)] | ||||
| public class ToolItem : Item | ||||
| { | ||||
|  | ||||
|  | ||||
|     public ToolType toolType; | ||||
|     float durability = 1f; | ||||
|  | ||||
|     SpriteRenderer playerHandSpriteRenderer; | ||||
|  | ||||
|     public override void OnSelect() | ||||
|     { | ||||
|         playerHandSpriteRenderer = GameObject.Find("Player").transform.Find("Hand").gameObject.GetComponent<SpriteRenderer>(); | ||||
|         if (isSelected) | ||||
|         { | ||||
|             playerHandSpriteRenderer.GetComponent<SpriteRenderer>().sprite = sprite; | ||||
|         } | ||||
|         else | ||||
|         { | ||||
|             playerHandSpriteRenderer.GetComponent<SpriteRenderer>().sprite = null; | ||||
|         } | ||||
|  | ||||
|     } | ||||
| } | ||||
							
								
								
									
										11
									
								
								Assets/Scripts/Inventory/ToolItem.cs.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								Assets/Scripts/Inventory/ToolItem.cs.meta
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,11 @@ | ||||
| fileFormatVersion: 2 | ||||
| guid: c9a450f431b33414ab3a1f3b08250700 | ||||
| MonoImporter: | ||||
|   externalObjects: {} | ||||
|   serializedVersion: 2 | ||||
|   defaultReferences: [] | ||||
|   executionOrder: 0 | ||||
|   icon: {instanceID: 0} | ||||
|   userData:  | ||||
|   assetBundleName:  | ||||
|   assetBundleVariant:  | ||||
							
								
								
									
										10
									
								
								Assets/Scripts/Inventory/ToolType.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								Assets/Scripts/Inventory/ToolType.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,10 @@ | ||||
| using System.Collections; | ||||
| using System.Collections.Generic; | ||||
| using UnityEngine; | ||||
|  | ||||
| public enum ToolType | ||||
| { | ||||
|     AXE, | ||||
|     PICKAXE, | ||||
|     HOE, | ||||
| } | ||||
							
								
								
									
										11
									
								
								Assets/Scripts/Inventory/ToolType.cs.meta
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								Assets/Scripts/Inventory/ToolType.cs.meta
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,11 @@ | ||||
| fileFormatVersion: 2 | ||||
| guid: 4f9fcb5700fbcfa4d93940e88f197200 | ||||
| MonoImporter: | ||||
|   externalObjects: {} | ||||
|   serializedVersion: 2 | ||||
|   defaultReferences: [] | ||||
|   executionOrder: 0 | ||||
|   icon: {instanceID: 0} | ||||
|   userData:  | ||||
|   assetBundleName:  | ||||
|   assetBundleVariant:  | ||||
| @@ -6,7 +6,7 @@ using UnityEngine.UI; | ||||
|  | ||||
| public class UI_Inventory : MonoBehaviour | ||||
| { | ||||
|     Inventory playerInventory; | ||||
|  /*   Inventory playerInventory; | ||||
|     public Transform inventoryContainer; | ||||
|     public Transform itemSlotTemplate; | ||||
|     private RectTransform[] UIItemSlots; | ||||
| @@ -132,5 +132,5 @@ public class UI_Inventory : MonoBehaviour | ||||
|             UIItemSlots[index] = itemSlotRectTransform; | ||||
|             index++; | ||||
|         } | ||||
|     } | ||||
|     }*/ | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 j.mei7
					j.mei7