Item Selector
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class ItemSelector : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private GameObject[] itemButtons;
|
||||
[SerializeField] private Image[] itemImages;
|
||||
|
||||
|
||||
public void Init(Item[] items)
|
||||
{
|
||||
for (int i = 0; i < items.Length; i++)
|
||||
{
|
||||
if (items[i] != null)
|
||||
{
|
||||
itemButtons[i].SetActive(true);
|
||||
itemImages[i].sprite = items[i].sprite;
|
||||
}
|
||||
else
|
||||
{
|
||||
itemButtons[i].SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0eebc4bee1ee3be48bb72d5aefe33a57
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user