This commit is contained in:
DerTyp187
2021-10-12 11:33:53 +02:00
parent 75a6f34ece
commit 646ab383f0
6 changed files with 1038 additions and 125 deletions

View 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;
}
}