Plate holding object logic
This commit is contained in:
parent
7a3073ea8a
commit
3256232b12
8 changed files with 121 additions and 7 deletions
|
@ -140,13 +140,35 @@ public class StoveCounter : BaseCounter, IHasProgress
|
|||
// 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();
|
||||
}
|
||||
}
|
||||
|
||||
state = State.Idle;
|
||||
|
||||
OnStateChanged?.Invoke(this, new OnStateChangedEventArgs
|
||||
{
|
||||
state = state,
|
||||
});
|
||||
|
||||
OnProgressChange?.Invoke(this, new IHasProgress.OnProgressChangeEventsArgs
|
||||
{
|
||||
progressNormalized = 0f,
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
// player has nothing
|
||||
GetKitchenObject().SetKitchenObjectParent(player);
|
||||
|
||||
state = State.Idle;
|
||||
|
||||
OnStateChanged?.Invoke(this, new OnStateChangedEventArgs
|
||||
{
|
||||
state = state,
|
||||
|
|
Reference in a new issue