Exemple #1
0
    public void ContinueOnSteps(RecipeModule.Food relatedFood, Step relatedStep)
    {
        Step nextStep = GetNextRelatedStep(relatedStep);

        if (nextStep != null)
        {
            PseudoAction      action = nextStep.GetPseudoAction();
            RecipeModule.Food f      = null;
            switch (action.GetActionType())
            {
            case RecipeModule.Action.ActionType.Boil:
                f = recipe.DescribeNewBoilAction(nextStep.GetStepNumber(), relatedFood, action.GetParameterValues()[0]);
                break;

            case RecipeModule.Action.ActionType.Break:
                f = recipe.DescribeNewBreakAction(nextStep.GetStepNumber(), relatedFood);
                break;

            case RecipeModule.Action.ActionType.Chop:
                f = recipe.DescribeNewChopAction(nextStep.GetStepNumber(), relatedFood, action.GetParameterValues()[0]);
                break;

            case RecipeModule.Action.ActionType.Cook:
                f = recipe.DescribeNewCookAction(nextStep.GetStepNumber(), relatedFood, action.GetParameterValues()[0], action.GetParameterValues()[1]);
                break;

            case RecipeModule.Action.ActionType.Fry:
                f = recipe.DescribeNewFryAction(nextStep.GetStepNumber(), relatedFood, action.GetParameterValues()[0]);
                break;

            case RecipeModule.Action.ActionType.Peel:
                f = recipe.DescribeNewPeelAction(nextStep.GetStepNumber(), relatedFood);
                break;

            case RecipeModule.Action.ActionType.Smash:
                f = recipe.DescribeNewSmashAction(nextStep.GetStepNumber(), relatedFood);
                break;

            case RecipeModule.Action.ActionType.Squeeze:
                f = recipe.DescribeNewSqueezeAction(nextStep.GetStepNumber(), relatedFood);
                break;

            case RecipeModule.Action.ActionType.Empty:
                // Do nothing, use same food object
                f = relatedFood;
                break;

            default:
                f = null;
                break;
            }

            ContinueOnSteps(f, nextStep);
        }
    }
Exemple #2
0
        void Start()
        {
            Recipe recipe = new Recipe("Chicken_Fleto");

            //// Recipe task list start
            recipe.SetRecipeName("Chicken_Fleto");

            // Chop 3 chicken fletos
            Food chicken_chopped_1 = recipe.DescribeNewChopAction(0, chicken, 2); // Focused chicken object
            Food chicken_chopped_2 = recipe.DescribeNewChopAction(1, chicken, 2);
            Food chicken_chopped_3 = recipe.DescribeNewChopAction(2, chicken, 2);

            // Put them together - Put 2 & 3 to near of 1
            Food chicken_put_2 = recipe.DescribeNewPutTogetherAction(3, chicken_chopped_2, chicken_chopped_1, 0);
            Food chicken_put_3 = recipe.DescribeNewPutTogetherAction(4, chicken_chopped_3, chicken_chopped_1, 0);

            // Chop 2 tomatoes
            Food tomato_chopped_1 = recipe.DescribeNewChopAction(5, tomato, 6);
            Food tomato_chopped_2 = recipe.DescribeNewChopAction(6, tomato, 6);

            // Put chopped tomatoes near chicken_1
            Food tomato_put_1 = recipe.DescribeNewPutTogetherAction(7, tomato_chopped_1, chicken_chopped_1, 0);
            Food tomato_put_2 = recipe.DescribeNewPutTogetherAction(8, tomato_chopped_2, chicken_chopped_1, 0);

            // Peel a potato
            Food potato_peeled = recipe.DescribeNewPeelAction(9, potato);

            // Chop the peeled potato
            Food potato_chopped = recipe.DescribeNewChopAction(10, potato_peeled, 6);

            // Put chopped potato near chicken_1
            Food potato_put = recipe.DescribeNewPutTogetherAction(11, potato_chopped, chicken_chopped_1, 0);

            // Cook'em'all
            Food chicken_cooked_1 = recipe.DescribeNewCookAction(12, chicken_chopped_1.GetLatestState(), 150, 600);
            Food chicken_cooked_2 = recipe.DescribeNewCookAction(13, chicken_chopped_2.GetLatestState(), 150, 600);
            Food chicken_cooked_3 = recipe.DescribeNewCookAction(14, chicken_chopped_3.GetLatestState(), 150, 600);
            Food tomato_cooked_1  = recipe.DescribeNewCookAction(15, tomato_chopped_1.GetLatestState(), 150, 600);
            Food tomato_cooked_2  = recipe.DescribeNewCookAction(16, tomato_chopped_2.GetLatestState(), 150, 600);
            Food potato_cooked    = recipe.DescribeNewCookAction(17, potato_chopped.GetLatestState(), 150, 600);

            //// Recipe task list end

            // Save recipe
            Recipe.SaveRecipe(recipe);
        }
Exemple #3
0
    public void ParseRecipe()
    {
        var culture = new CultureInfo("de-DE");

        recipe = new RecipeModule.Recipe("DEMO_RECIPE_" + DateTime.Now.ToString(culture).Replace(":", "_").Replace(" ", "_"));

        // Reorder steps
        List <Step> orderedSteps = new List <Step>(steps.Count);

        foreach (Step s in steps)
        {
            orderedSteps.Insert(s.GetStepNumber() - 1, s);
        }

        foreach (Step s in orderedSteps)
        {
            if (s.GetInput() is FoodState)
            {
                FoodState inputItem = (FoodState)(s.GetInput());

                // This is initial food
                if (!inputItem.GetComponent <Text>().text.Contains("Output") && !inputItem.GetComponent <Text>().text.Contains("Group"))
                {
                    string            foodIdentifier = inputItem.GetComponent <Text>().text;
                    PseudoAction      action         = s.GetPseudoAction();
                    RecipeModule.Food f = null;
                    switch (action.GetActionType())
                    {
                    case RecipeModule.Action.ActionType.Boil:
                        f = recipe.DescribeNewBoilAction(s.GetStepNumber(), foodIdentifier, action.GetParameterValues()[0]);
                        break;

                    case RecipeModule.Action.ActionType.Break:
                        f = recipe.DescribeNewBreakAction(s.GetStepNumber(), foodIdentifier);
                        break;

                    case RecipeModule.Action.ActionType.Chop:
                        f = recipe.DescribeNewChopAction(s.GetStepNumber(), foodIdentifier, action.GetParameterValues()[0]);
                        break;

                    case RecipeModule.Action.ActionType.Cook:
                        f = recipe.DescribeNewCookAction(s.GetStepNumber(), foodIdentifier, action.GetParameterValues()[0], action.GetParameterValues()[1]);
                        break;

                    case RecipeModule.Action.ActionType.Fry:
                        f = recipe.DescribeNewFryAction(s.GetStepNumber(), foodIdentifier, action.GetParameterValues()[0]);
                        break;

                    case RecipeModule.Action.ActionType.Peel:
                        f = recipe.DescribeNewPeelAction(s.GetStepNumber(), foodIdentifier);
                        break;

                    case RecipeModule.Action.ActionType.Smash:
                        f = recipe.DescribeNewSmashAction(s.GetStepNumber(), foodIdentifier);
                        break;

                    case RecipeModule.Action.ActionType.Squeeze:
                        f = recipe.DescribeNewSqueezeAction(s.GetStepNumber(), foodIdentifier);
                        break;

                    default:
                        f = null;
                        break;
                    }

                    ContinueOnSteps(f, s);
                }
            }
        }

        print("Parsing Completed");

        recipe.ReorderActions();

        print("Reordering Completed");

        foreach (RecipeModule.Action a in recipe.GetActions())
        {
            print(a.GetStepNumber() + ": " + a.GetActionType());
            print("In: " + a.GetInvolvedFood().GetFoodIdentifier());
            print("Out: " + a.GetResultedFood().GetFoodIdentifier());
            print("\n");
        }

        print("Initial Foods");
        foreach (RecipeModule.Food f in recipe.GetInitialFoods())
        {
            print(f.GetFoodIdentifier());
        }

        RecipeModule.Recipe.SaveRecipe(recipe);
    }