private void DrawItemButtons(int allButtonIndex) { //////////////////////////////////////// //Local Variables int itemIndex = 0; AbstractItemAI item = null; //////////////////////////////////////// /* * NOTE: GetStartPageIndex() will return a new spot somewhere within the list of items to start based on pageIndex. For example, if pageIndex was 1 * and itemButtons.Length was 6, then it will start at 0 and will retrieve 0 + allButtonIndex from all the items. However if pageIndex was 2, then it * will return 6 + allButtonIndex from all the items. */ itemIndex = GetStartPageIndex() + allButtonIndex; item = MainController.GetComponent <MainInventory>().GetItem(itemIndex); if (item == null) { return; } ItemButtons[allButtonIndex].Content.text = item.ItemName; if (ItemButtons[allButtonIndex].Draw() == true) { gameObject.GetComponent <ItemActionMenu>().SetItemIndex(itemIndex); } }
public void ItemEquip(AbstractItemAI item) { ///////////////////////////////////////////// //Local Variables ItemEquipBackEnd backend = new ItemEquipBackEnd(); ///////////////////////////////////////////// backend.Start(item, this); }
private void Equip(AbstractItemAI item, FighterAttributes fighter) { if (fighter.Equipment.ContainsKey(item.Slot) == true) { fighter.ItemUnequip(item.Slot); } fighter.Equipment.Add(item.Slot, item); fighter.UpdateBonusAttributes(); }
public void Start(AbstractItemAI item, FighterAttributes fighter) { try { Equip(item, fighter); } catch (Exception ex) { StaticTrace.Log(ex.Message); StaticTrace.Log(ex.StackTrace); } }
public void ChangeState(AbstractItemAI newState) { if (newState == null) { return; } if (MainState != null) { MainState.Exit(gameObject); } newState.Enter(gameObject); MainState = newState; }
private GameObject CreateItem(AbstractItemAI itemAI) { ///////////////////////////////////////////////// //Local Variables GameObject item; ///////////////////////////////////////////////// item = UnityEngine.Object.Instantiate(this.PrefabDictionary[itemAI.ItemName]) as GameObject; item.GetComponent <ItemAI>().ChangeState(itemAI); item.GetComponent <PreserveItemInInventory>().PreserveItem(); item.name = RemoveCloneFromName.Start(item.name); return(item); }
void Awake() { MainState = new BlankItemAI(); }