Пример #1
0
        private bool TryAddIngredients(List <Ingredient> ingredients)
        {
            if (!IsEmpty())
            {
                return(false);
            }
            if (Plate.CheckSoupIngredients(ingredients) == false)
            {
                return(false);
            }
            Ingredients.AddRange(ingredients);

            foreach (var ingredient in Ingredients)
            {
                ingredient.transform.SetParent(Slot);
                ingredient.transform.SetPositionAndRotation(Slot.transform.position, Quaternion.identity);
            }

            SetLiquidLevelAndColor();

            IsCookFinished = true;
            UpdateIngredientsUI();
            return(true);
        }
Пример #2
0
        public override bool TryToDropIntoSlot(IPickable pickableToDrop)
        {
            switch (pickableToDrop)
            {
            case Ingredient ingredient:
                if (ingredient.Status != IngredientStatus.Processed)
                {
                    Debug.Log("[CookingPot] Only accept chopped/processed ingredients");
                    return(false);
                }
                if (ingredient.Type == IngredientType.Onion ||
                    ingredient.Type == IngredientType.Tomato ||
                    ingredient.Type == IngredientType.Mushroom)
                {
                    return(TryDrop(pickableToDrop));
                }
                Debug.Log("[CookingPot] Only accept Onions, tomatoes or Mushrooms");
                return(false);

            case Plate plate:

                if (IsEmpty())
                {
                    if (plate.IsEmpty() == false && Plate.CheckSoupIngredients(plate.Ingredients))
                    {
                        // Drop soup back into CookingPot
                        TryAddIngredients(plate.Ingredients);
                        plate.RemoveAllIngredients();
                        return(false);
                    }
                }

                if (IsCookFinished && !IsBurned)
                {
                    if (IsBurned)
                    {
                        return(false);
                    }
                    if (plate.IsClean == false)
                    {
                        return(false);
                    }

                    bool isSoup = Plate.CheckSoupIngredients(this.Ingredients);

                    if (!isSoup)
                    {
                        return(false);
                    }

                    plate.AddIngredients(this.Ingredients);
                    EmptyPan();
                    return(false);
                }
                break;

            default:
                Debug.LogWarning("[ChoppingBoard] Refuse everything else");
                return(false);
            }
            return(false);
        }