public bool tempClicked = false; // whether temperature buttons are clicked void Start() { // find gameobject with tag "SelectedStore", which is Menus, and access this component store = GameObject.FindGameObjectWithTag("SelectedStore").GetComponent <MenuSelection>(); // same for "DrinccStorage" storage = GameObject.FindGameObjectWithTag("DrinccStorage").GetComponent <DrinccStorage>(); try { backButton.onClick.AddListener(BackPageClick); // this causes an unknown error (not set to an object), but still works } catch (System.Exception e) { Debug.Log(e.Message); } // same as FlavorSelect.cs, add variable in its own scope for (int i = 0; i < toppings.Length; i++) { int temp = i; toppings[i].onClick.AddListener(delegate { ToppingClick(temp); GameObject.FindGameObjectWithTag("UpdateTrigger").GetComponent <ConfirmUpdate>().update = true; }); } }
void Start() { store = GameObject.FindGameObjectWithTag("SelectedStore").GetComponent <MenuSelection>(); storage = GameObject.FindGameObjectWithTag("DrinccStorage").GetComponent <DrinccStorage>(); cameraAnimator = GameObject.FindGameObjectWithTag("CameraTrigger").GetComponent <CameraControl>(); backButton.onClick.AddListener(BackPageClick); buyButton.onClick.AddListener(StartProcess); }
public bool runOnce = false; // so update part won't keep looping void Start() { store = GameObject.FindGameObjectWithTag("SelectedStore").GetComponent <MenuSelection>(); storage = GameObject.FindGameObjectWithTag("DrinccStorage").GetComponent <DrinccStorage>(); // show first page and hide other pages currPage = 0; pages[currPage].SetActive(true); for (int i = currPage + 1; i < pages.Length; i++) { pages[i].SetActive(false); } // show only next button back.SetActive(false); next.SetActive(true); // add listener to back and next buttons back.GetComponent <Button>().onClick.AddListener(BackClick); next.GetComponent <Button>().onClick.AddListener(NextClick); }
void Start() { storage = GameObject.FindGameObjectWithTag("DrinccStorage").GetComponent <DrinccStorage>(); for (int i = 0; i < flavorButtons.Length; i++) { int temp = i; flavorButtons[i].onClick.AddListener(delegate { FlavorAdd(temp); }); } for (int i = 0; i < toppingButtons.Length; i++) { int temp = i; toppingButtons[i].onClick.AddListener(delegate { ToppingAdd(temp); }); } currPage = 0; for (int i = 0; i < pages.Length; i++) { if (i == 0) { pages[i].SetActive(true); } else { pages[i].SetActive(false); } } back.SetActive(false); next.SetActive(true); back.GetComponent <Button>().onClick.AddListener(BackClick); next.GetComponent <Button>().onClick.AddListener(NextClick); update = true; }