TestRecipe() public method

public TestRecipe ( IRecipe recipe ) : float
recipe IRecipe
return float
示例#1
0
        void HandleTournamentEnd()
        {
            foreach (var component in _components) {
                PSDebug.Log ("Component: {0}", component.Recipe.ID ());
            }
            var groups = _components
                .Select (match => new WeightedValue (
                             TypeForComponent (match.Component),
                             match.Recipe.Group,
                             match.Quality
                         ))
                .ToList ();

            var evaluator = new RecipeEvaluator (groups, SupplementForPiza);
            var pizzaMatch = evaluator.TestRecipe (_pizzaDefinition);
            PSDebug.Log ("pizza match is: {0}", pizzaMatch);
            GameController.Instance.PizzaMatch = pizzaMatch;
            Application.LoadLevel(1);
        }
示例#2
0
        public RecipeMatch FindMatch(List<Ingredient> ingredients)
        {
            var ingridientGroups = ingredients.Select (ingr => new WeightedValue(ingr.Definition.Type, ingr.Definition.Group, 1) ).ToList ();
            var evaluator = new RecipeEvaluator (ingridientGroups, IngredientsSupplementsProvider);
            var maxQuality = 0.0f;
            IRecipe bestRecipe = null;
            foreach (var recipe in GetCurrentRecipes ()) {
                var quality = evaluator.TestRecipe (recipe);
                PSDebug.LogInfo ("Match result {0} = {1}, used groups: {2}", recipe.Description, quality, ingridientGroups.ToDebugString ());

                if (quality >= maxQuality) {
                    maxQuality = quality;
                    bestRecipe = recipe;
                }
            }

            return new RecipeMatch {
                Component = _currentComponent,
                Recipe = bestRecipe,
                Quality = maxQuality
            };
        }