public void SwapItemPanels(GameObject from, GameObject to) { ItemPanel panel = from.GetComponent <ItemPanel>(); ItemPanel otherPanel = to.GetComponent <ItemPanel>(); if (panel && otherPanel) { Equippable[] items = new Equippable[2]; items[0] = panel.obj; items[1] = otherPanel.obj; panel.Display(items[1]); otherPanel.Display(items[0]); Debug.Log("Display swap"); return; } EquippedItemPanel equipPanel = from.GetComponent <EquippedItemPanel>(); if (!equipPanel) { equipPanel = to.GetComponent <EquippedItemPanel>(); otherPanel = from.GetComponent <ItemPanel>(); } if (equipPanel.equipSlots == otherPanel.obj.defaultSlots || equipPanel.equipSlots == otherPanel.obj.secondarySlots) { Equippable[] items = new Equippable[2]; items[0] = equipPanel.obj; items[1] = otherPanel.obj; equipPanel.Display(items[1]); otherPanel.Display(items[0]); Debug.Log("Display swap"); return; } }
public void DisplayItem(Equippable obj, int index) { ItemPanel itemPanel = items[index]; if (itemPanel) { itemPanel.Display(obj); } }