mirror of
				https://github.com/DerTyp7/fps-citybuild-unity.git
				synced 2025-10-31 13:17:07 +01:00 
			
		
		
		
	update
This commit is contained in:
		
							
								
								
									
										28
									
								
								Assets/HUD/Hotbar/HotbarSlot.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								Assets/HUD/Hotbar/HotbarSlot.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,28 @@ | ||||
| using System.Collections; | ||||
| using System.Collections.Generic; | ||||
| using UnityEngine; | ||||
| using UnityEngine.UI; | ||||
|  | ||||
| public class HotbarSlot : MonoBehaviour | ||||
| { | ||||
|     public int HotbarSlotNumber; | ||||
|     public Item item; | ||||
|     public GameObject itemImage; | ||||
|     public GameObject HotbarSlotNum; | ||||
|  | ||||
|     private void Start() | ||||
|     { | ||||
|         itemImage = gameObject.transform.Find("Image").gameObject; | ||||
|         HotbarSlotNum = gameObject.transform.Find("HotbarSlotNum").gameObject; | ||||
|  | ||||
|         HotbarSlotNum.GetComponent<TMPro.TextMeshProUGUI>().text = HotbarSlotNumber.ToString(); | ||||
|         gameObject.name = "HotbarSlot " + HotbarSlotNumber.ToString(); | ||||
|     } | ||||
|  | ||||
|     public void ChangeItem(Item i) | ||||
|     { | ||||
|         item = i; | ||||
|         itemImage.GetComponent<Image>().sprite = item.icon; | ||||
|     } | ||||
|  | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 DerTyp187
					DerTyp187