Add Delivery Manager UI and UI logic

This commit is contained in:
BuyMyMojo 2023-03-03 03:54:19 +11:00
parent 8c5f4f2acf
commit 3ec46256e8
89 changed files with 14001 additions and 12 deletions

View file

@ -0,0 +1,43 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlateIconsUI : MonoBehaviour
{
[SerializeField] private PlateKitchenObject plateKitchenObject;
[SerializeField] private Transform iconTemplate;
private void Awake()
{
iconTemplate.gameObject.SetActive(false);
}
private void Start()
{
plateKitchenObject.OnIngreedientAdded += PlateKitchenObject_OnIngreedientAdded;
}
private void PlateKitchenObject_OnIngreedientAdded(object sender, PlateKitchenObject.OnIngreedientAddedEventArgs e)
{
UpdateVisual();
}
private void UpdateVisual()
{
foreach (Transform child in transform)
{
if (child == iconTemplate) continue;
Destroy(child.gameObject);
}
foreach (KitchenObjectSO kitchenObjectSO in plateKitchenObject.GetKitchenObjectSOList())
{
Transform iconTransform = Instantiate(iconTemplate, transform);
iconTransform.GetComponent<PlateIconSingleUI>().SetKitchenObjectSO(kitchenObjectSO);
iconTransform.gameObject.SetActive(true);
}
}
}