コード例 #1
0
    public void CreateMenuButton(Button button, Recipe recipe)
    {
        bool addRecipe = true;

        thisRecipe = recipe;
        newButton  = Instantiate(menuButton);
        newButton.transform.parent = content;
        content.sizeDelta          = new Vector2(content.rect.width, content.rect.height + 20);
        Debug.Log("Name of the recipe I have right now is (Create Menu Recipe) " + recipe.name);
        newButton.GetComponentInChildren <Text>().text = recipe.name;
        newButton.transform.localScale = new Vector3(1, 1, 1);
        RecipeCost recipeCost = newButton.gameObject.GetComponent <RecipeCost>();

        for (int i = 0; i < thisResturant.recipes.Count; i++)
        {
            if (thisResturant.recipes[i].recipe == recipe)
            {
                addRecipe = false;
                break;
            }
        }
        if (addRecipe)
        {
            thisResturant.AddRecipe(recipe);
        }
        Debug.Log("CreateMenuRecipes thisResturnat = " + thisResturant.GetInstanceID());
        thisResturant.recipeButtons.Add(newButton.gameObject);
        recipeCost.SetUp(thisRecipe, thisResturant);
    }
コード例 #2
0
    public void SetUp(Recipe recipe, BuildingRestaurant building)
    {
        isSetup = true;
        Debug.Log("RecipeCost building = " + building.GetInstanceID());
        thisRecipe    = recipe;
        thisRestruant = building;
        Debug.Log("Recipe cost says that this resturANT has " + building.recipes.Count + " resturnat recipes");
        for (int i = 0; i < building.recipes.Count; i++)
        {
            if (thisRecipe == building.recipes[i].recipe)
            {
                thisRR = building.recipes[i];
                break;
            }
        }

        costSlider.value = 1;
        UpdateText();
        Debug.Log("Restaurant from PlayerData " + GameController.Instance().activePlayer.restaurantClicked.GetInstanceID());
    }