// Jimmy Vegas Unity Tutorials // Thesescripts will be the basics for a shop //GLOBALSHOP public class GlobalShop : MonoBehaviour { public static string Item01; public static string Item02; public static string Item03; public static string Item04; public static int ShopNumber; void Update () { if (ShopNumber == 1) { Item01 = "Wood Block"; Item02 = "Black Feather"; Item03 = "Red Potion"; Item04 = "Blue Potion"; } if (ShopNumber == 2) { Item01 = "Iron Block"; Item02 = "Black Feather"; Item03 = "Red Potion"; Item04 = ""; } } } //==================== //SHOP01ACCESS: using UnityEngine.UI; public class Shop01Access : MonoBehaviour { public GameObject ShopInventory; public GameObject Item01Text; public GameObject Item02Text; public GameObject Item03Text; public GameObject Item04Text; public GameObject ItemCompletion; public GameObject CompleteText; void OnTriggerEnter () { ShopInventory.SetActive (true); Screen.lockCursor = false; GlobalShop.ShopNumber = 1; Item01Text.GetComponent ().text = "" + GlobalShop.Item01; Item02Text.GetComponent ().text = "" + GlobalShop.Item02; Item03Text.GetComponent ().text = "" + GlobalShop.Item03; Item04Text.GetComponent ().text = "" + GlobalShop.Item04; } public void Item01() { ItemCompletion.SetActive (true); CompleteText.GetComponent ().text = "Are you sure you want to buy " + GlobalShop.Item01 + "?"; } public void Item02() { ItemCompletion.SetActive (true); CompleteText.GetComponent ().text = "Are you sure you want to buy " + GlobalShop.Item02 + "?"; } public void Item03() { ItemCompletion.SetActive (true); CompleteText.GetComponent ().text = "Are you sure you want to buy " + GlobalShop.Item03 + "?"; } public void Item04() { ItemCompletion.SetActive (true); CompleteText.GetComponent ().text = "Are you sure you want to buy " + GlobalShop.Item04 + "?"; } public void CancelTransaction () { ItemCompletion.SetActive (false); } }