mirror of
				https://github.com/DerTyp7/example-top-down-unity.git
				synced 2025-10-30 12:57:08 +01:00 
			
		
		
		
	Added TMP
This commit is contained in:
		| @@ -4,29 +4,37 @@ using UnityEngine; | ||||
|  | ||||
| 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)  | ||||
|     /// </summary> | ||||
|  | ||||
|     Item item; | ||||
|     int maxItems; | ||||
|     int count; | ||||
|     public Slot(int maxItems) | ||||
|     { | ||||
|         item = null; | ||||
|         this.maxItems = maxItems; | ||||
|         count = 0; | ||||
|  | ||||
|     } | ||||
|     public bool removeItem(int count = 1)  | ||||
|     { | ||||
|         this.count -= count; | ||||
|         return true; | ||||
|     } | ||||
|     public bool addItem(int count = 1) | ||||
|     { | ||||
|         this.count += count; | ||||
|         return true; | ||||
|  | ||||
|     } | ||||
|     int maxItems = 1; | ||||
|     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) | ||||
|     { | ||||
|         item = null; | ||||
|         this.maxItems = maxItems; | ||||
|     } | ||||
|     public void addItem(int count = 1) | ||||
|     { | ||||
|         // adds any number of items to the slot will also go over the max items | ||||
|         this.count += count; | ||||
|     } | ||||
|     public void removeItem(int count = 1)  | ||||
|     { | ||||
|         // removes any number of items from the slot will also go negative  | ||||
|         this.count -= count; | ||||
|     }     | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 julius
					julius