Exemple #1
0
    public void dropped(Ingredient ingredient)
    {
        foreach (IngredientHolder ingredientHolder in ingredientsHolders)
        {
            RectTransform rectTransform = ingredientHolder.transform as RectTransform;
            if (RectTransformUtility.RectangleContainsScreenPoint(rectTransform, Input.mousePosition))
            {
                int index = holderToIndex[ingredientHolder];
                foreach (IngredientHolder ingredientHolderTemp in ingredientsHolders)
                {
                    if (ingredientHolderTemp.renderedIngredient == ingredient)
                    {
                        menuLibrary.removeIngredient(ingredient);
                        if (ingredientHolderTemp != ingredientHolder)
                        {
                            ingredientHolderTemp.renderIngredient(null);
                        }
                    }
                }

                if (ingredientHolder.renderedIngredient != null)
                {
                    // MenuLibrary.Instance.removeIngredient(ingredientHolder.renderedIngredient);
                }

                menuLibrary.addIngredient(ingredient, index);
                ingredientHolder.setIngredient(ingredient);
            }
        }
    }