This repository has been archived on 2025-03-20. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
mojo-kitchen-chaos/Assets/Scripts/PlateCompleteVisual.cs

39 lines
1.2 KiB
C#

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlateCompleteVisual : MonoBehaviour
{
[Serializable]
public struct KitchenObjectSO_GameObject
{
public KitchenObjectSO kitchenObjectSO;
public GameObject gameObject;
}
[SerializeField] private PlateKitchenObject plateKitchenObject;
[SerializeField] private List<KitchenObjectSO_GameObject> kitchenObjectSOGameObjectList;
private void Start()
{
plateKitchenObject.OnIngreedientAdded += PlateKitchenObject_OnIngreedientAdded;
foreach (KitchenObjectSO_GameObject kitchenObjectSOGameObject in kitchenObjectSOGameObjectList)
{
kitchenObjectSOGameObject.gameObject.SetActive(false);
}
}
private void PlateKitchenObject_OnIngreedientAdded(object sender, PlateKitchenObject.OnIngreedientAddedEventArgs e)
{
foreach (KitchenObjectSO_GameObject kitchenObjectSOGameObject in kitchenObjectSOGameObjectList)
{
if (kitchenObjectSOGameObject.kitchenObjectSO == e.KitchenObjectSO)
{
kitchenObjectSOGameObject.gameObject.SetActive(true);
}
}
}
}