ProjectDDD/Assets/_DDD/_Scripts/Restaurant/Ui/CookUi/SelectedIngredient.cs
2025-08-27 17:25:11 +09:00

30 lines
813 B
C#

using UnityEngine;
using UnityEngine.UI;
namespace DDD.Restaurant
{
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)
{
if (ingredientEntry == null)
{
IngredientImage.sprite = null;
SetActive(false);
return;
}
IngredientImage.sprite = DataManager.Instance.GetSprite(ingredientEntry.IngredientId);
SetActive(IngredientImage.sprite);
}
}
}