Plate holding object logic

This commit is contained in:
BuyMyMojo 2023-03-02 05:48:13 +11:00
parent 7a3073ea8a
commit 3256232b12
8 changed files with 121 additions and 7 deletions

View file

@ -27,7 +27,27 @@ public class ClearCounter : BaseCounter
// KitchenObject is here
if (player.HasKitchenObject())
{
// player has object, do nothing
// player has object
if (player.GetKitchenObject().TryGetPlate(out PlateKitchenObject plateKitchenObject))
{
// Player is holding a plate
if (plateKitchenObject.TryAddIngreedient(GetKitchenObject().GetKitchenObjectSO()))
{
GetKitchenObject().DestroySelf();
}
} else
{
// player not carrying plate but other object
if (GetKitchenObject().TryGetPlate(out plateKitchenObject))
{
// Counter holds plate
if (plateKitchenObject.TryAddIngreedient(player.GetKitchenObject().GetKitchenObjectSO()))
{
player.GetKitchenObject().DestroySelf();
}
}
}
}
else
{