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); }
public void PopulateMenuButtons(RestaurantRecipe rr) { GameObject b = Instantiate(menuButton); b.transform.parent = content; content.sizeDelta = new Vector2(content.rect.width, content.rect.height + 40); b.GetComponentInChildren <Text>().text = rr.recipe.name; b.transform.localScale = new Vector3(1, 1, 1); RecipeCost recipeCost = b.gameObject.GetComponent <RecipeCost>(); recipeCost.SetUp(rr); }
//This is an attempt at repopulating the menu, not so successful //called for making the button only. Not adding a recipe to the restaurant public void CreateMenuButton(RestaurantRecipe rr) { GameObject b = Instantiate(menuButton); b.transform.parent = content; content.sizeDelta = new Vector2(content.rect.width, content.rect.height + 40); Debug.Log("Name of the recipe I have right now is (Create Menu Recipe) " + rr.recipe.name); b.GetComponentInChildren <Text>().text = rr.recipe.name; b.transform.localScale = new Vector3(1, 1, 1); RecipeCost recipeCost = b.gameObject.GetComponent <RecipeCost>(); thisResturant.recipeButtons.Add(b.gameObject); //recipeCost.SetUp(thisRecipe, thisResturant); recipeCost.SetUp(thisRecipe, thisResturant); }
public void Setup() { rCost.SetUp(GameController.Instance().activePlayer.restaurantClicked.recipes[recipeIndex]); }