private void RemoveButton(ItemGUIButton iGB) { //Debug.Log("Removing..." + iGB.name); buttons.Remove(iGB); itemsWithGUI.Remove(iGB.itemToUse); Destroy(iGB.gameObject); }
public void BeginCombatTutorial() { tutorial.StopTimer(); tutorialState = TutorialSequence.Beginning; combatGrid.transform.parent.gameObject.SetActive(true); items.SetActive(true); foreach (Button b in buttons) { b.interactable = false; } itemButtons = GameObject.FindObjectsOfType <ItemGUIButton>(); foreach (ItemGUIButton b in itemButtons) { b.GetComponent <Button>().interactable = false; } potionButton = System.Array.Find(itemButtons, item => item.itemToUse.GetType() == typeof(Potion)); potionButton.gameObject.GetComponent <Button>().onClick.AddListener(PotionButtonTutorial); tutorial.SetTutorialText("This is how you help others out, by Battling Sadness! The buttons at the bottom detail what you can do!", beginningTime); items.SetActive(false); }
private void CreateNewButton(Item item) { //Instantiate In Combat Grid GameObject newItemButton = Instantiate(combatItemButtonPrefab, combatItemGrid) as GameObject; ItemGUIButton iGB = newItemButton.GetComponent <ItemGUIButton>(); iGB.GetComponentInChildren <UnityEngine.UI.Text>().text = item.ItemName + " x1"; iGB.itemToUse = item; itemsWithGUI.Add(item); buttons.Add(iGB); //Instantiate In Main Inventory Grid GameObject newInventoryItem = Instantiate(mainInventoryItemButtonPrefab, mainInventoryItemGrid) as GameObject; ItemGUIButton iGB2 = newInventoryItem.GetComponent <ItemGUIButton>(); iGB2.GetComponentInChildren <UnityEngine.UI.Text>().text = item.ItemName + " x1"; iGB2.itemToUse = item; buttons.Add(iGB2); }