ProjectDDD/Assets/_DDD/_Scripts/Restaurant/Ui/CookUi/SelectedIngredient.cs

30 lines
813 B
C#
Raw Normal View History

2025-08-26 04:59:03 +00:00
using UnityEngine;
using UnityEngine.UI;
namespace DDD.Restaurant
2025-08-26 04:59:03 +00:00
{
public class SelectedIngredient : MonoBehaviour
{
[field: SerializeField] public Image IngredientImage { get; set; }
public void Initialize()
{
SetActive(false);
}
private void SetActive(bool active) => IngredientImage.gameObject.SetActive(active);
public void SetIngredientEntry(IngredientEntry ingredientEntry)
{
2025-08-26 09:56:40 +00:00
if (ingredientEntry == null)
{
IngredientImage.sprite = null;
SetActive(false);
return;
}
IngredientImage.sprite = DataManager.Instance.GetSprite(ingredientEntry.IngredientId);
2025-08-26 04:59:03 +00:00
SetActive(IngredientImage.sprite);
}
}
}