Visualise burger construction on plate
This commit is contained in:
parent
3256232b12
commit
42cd3341fb
8 changed files with 388 additions and 11 deletions
39
Assets/Scripts/PlateCompleteVisual.cs
Normal file
39
Assets/Scripts/PlateCompleteVisual.cs
Normal file
|
@ -0,0 +1,39 @@
|
|||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Scripts/PlateCompleteVisual.cs.meta
Normal file
11
Assets/Scripts/PlateCompleteVisual.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 27253c78be049da418db6f769fc2142e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,3 +1,4 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
@ -5,6 +6,12 @@ using UnityEngine;
|
|||
public class PlateKitchenObject : KitchenObject
|
||||
{
|
||||
|
||||
public event EventHandler<OnIngreedientAddedEventArgs> OnIngreedientAdded;
|
||||
public class OnIngreedientAddedEventArgs : EventArgs
|
||||
{
|
||||
public KitchenObjectSO KitchenObjectSO;
|
||||
}
|
||||
|
||||
[SerializeField] private List<KitchenObjectSO> validKitchenObjectSOList;
|
||||
|
||||
private List<KitchenObjectSO> kitchenObjectSOList;
|
||||
|
@ -27,6 +34,12 @@ public class PlateKitchenObject : KitchenObject
|
|||
} else
|
||||
{
|
||||
kitchenObjectSOList.Add(kitchenObjectSO);
|
||||
|
||||
OnIngreedientAdded?.Invoke(this, new OnIngreedientAddedEventArgs
|
||||
{
|
||||
KitchenObjectSO = kitchenObjectSO,
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue