38 lines
994 B
C#
38 lines
994 B
C#
|
|
using System.Collections;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using UnityEngine;
|
|||
|
|
|
|||
|
|
public class CraftingMenuController : MonoBehaviour {
|
|||
|
|
[SerializeField] public GameObject menuItemObject;
|
|||
|
|
|
|||
|
|
private List<GameObject> menuItems;
|
|||
|
|
|
|||
|
|
public void Setup(Npc npc) {
|
|||
|
|
foreach (Transform child in transform) {
|
|||
|
|
Destroy(child.gameObject);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
menuItems = new List<GameObject>();
|
|||
|
|
|
|||
|
|
foreach (Item item in npc.craftingList.items.Keys) {
|
|||
|
|
GameObject menuItem = Instantiate(menuItemObject);
|
|||
|
|
menuItem.GetComponent<CraftingMenuItemController>().Setup(item, (Hashtable)npc.craftingList.items[item]);
|
|||
|
|
menuItem.transform.SetParent(this.transform);
|
|||
|
|
menuItem.transform.localScale = Vector3.one;
|
|||
|
|
menuItems.Add(menuItem);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// Start is called before the first frame update
|
|||
|
|
void Start()
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// Update is called once per frame
|
|||
|
|
void Update()
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|