using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using TMPro; using System; public class Recipe : MonoBehaviour { public Player localPlayer; int PlayerCount; public Vegetable[] Veggies; public Frame[] Frames; public int[] Qtys; public GameObject RecipeCanvas; public Image Inventory; // Use this for initialization void Start () { for (int i = 0; i < PlayerCount; i++) { int rand = UnityEngine.Random.Range(0, Qtys.Length - 1); Qtys[rand] += 1; } for (int i = 0; i < 4; i++) //Set the recipe UI { Frames[i].VegetableSpot.sprite = Veggies[i].Image; Frames[i].Qty.text = Qtys[i] + ""; } } //Button calls public void OpenRecipe() { RecipeCanvas.SetActive(true); } public void CloseRecipe() { RecipeCanvas.SetActive(false); } //Veggie interactions public void pickupItem(Vegetable newVeggie) { localPlayer.heldVeggie = newVeggie; Inventory.gameObject.SetActive(true); Inventory.sprite = newVeggie.Image; } public void dropItem() { localPlayer.heldVeggie = null; Inventory.gameObject.SetActive(false); } } [Serializable] public class Vegetable { public string Name; public Sprite Image; } [Serializable] public class Frame { public Image VegetableSpot; public TextMeshProUGUI Qty; }