30 lines
813 B
C#
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);
|
|
}
|
|
}
|
|
} |