Plate holding object logic
This commit is contained in:
parent
7a3073ea8a
commit
3256232b12
8 changed files with 121 additions and 7 deletions
33
Assets/Scripts/PlateKitchenObject.cs
Normal file
33
Assets/Scripts/PlateKitchenObject.cs
Normal file
|
@ -0,0 +1,33 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class PlateKitchenObject : KitchenObject
|
||||
{
|
||||
|
||||
[SerializeField] private List<KitchenObjectSO> validKitchenObjectSOList;
|
||||
|
||||
private List<KitchenObjectSO> kitchenObjectSOList;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
kitchenObjectSOList = new List<KitchenObjectSO>();
|
||||
}
|
||||
|
||||
public bool TryAddIngreedient(KitchenObjectSO kitchenObjectSO)
|
||||
{
|
||||
if (!validKitchenObjectSOList.Contains(kitchenObjectSO))
|
||||
{
|
||||
// Not a valid ingreedient
|
||||
return false;
|
||||
}
|
||||
if (kitchenObjectSOList.Contains(kitchenObjectSO))
|
||||
{
|
||||
return false;
|
||||
} else
|
||||
{
|
||||
kitchenObjectSOList.Add(kitchenObjectSO);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
Reference in a new issue