40 lines
1.1 KiB
C#
40 lines
1.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class PlateCompleteVisual : MonoBehaviour
|
|
{
|
|
|
|
[Serializable]
|
|
public struct KitchenObjectSOGameObject
|
|
{
|
|
public KitchenObjectSO kitchenObjectSO;
|
|
public GameObject gameObject;
|
|
}
|
|
|
|
[SerializeField] private PlateKitchenObject plateKitchenObject;
|
|
[SerializeField] private List<KitchenObjectSOGameObject> kitchenObjectSOGameObjectList;
|
|
|
|
private void Start()
|
|
{
|
|
plateKitchenObject.OnIngredientAdded += PlateKitchenObject_OnIngredientAdded;
|
|
foreach (KitchenObjectSOGameObject kitchenObjectSOGameObject in kitchenObjectSOGameObjectList)
|
|
{
|
|
kitchenObjectSOGameObject.gameObject.SetActive(false);
|
|
}
|
|
}
|
|
|
|
private void PlateKitchenObject_OnIngredientAdded(object sender, PlateKitchenObject.IngredientAddedEventArgs e)
|
|
{
|
|
foreach (KitchenObjectSOGameObject gO in kitchenObjectSOGameObjectList)
|
|
{
|
|
// Debug.Log($"{gO.kitchenObjectSO} wird mit {e.KitchenObjectSO} verglichen... {gO.kitchenObjectSO == e.KitchenObjectSO}");
|
|
if (gO.kitchenObjectSO == e.KitchenObjectSO)
|
|
{
|
|
// Debug.Log($"{gO.gameObject} wird aktiviert!");
|
|
gO.gameObject.SetActive(true);
|
|
}
|
|
}
|
|
}
|
|
}
|