public void OnClickEquip() { if (!MPC.GetInventoryItem(Slot).isNull) { if (MPC.Compatible(E)) { if (!MPC.GetEquippedItem(E.EquipType).isNull) //Has Equipped Item { Equipment TakeOff = MPC.GetEquippedItem(E.EquipType); MPC.UnEquip(TakeOff.EquipType); MPC.Equip(E); transform.parent.parent.Find("EquippedSlotButtons/" + (int)E.EquipType).GetComponent <EquippedButtonController>().UpdateSlot(); MPC.RemoveFromInventory(Slot); MPC.AddToInventory(Slot, TakeOff); UpdateSlot(); EI.Show(E, EquipmentInfo.Mode.Inventory); } else //No Equipped Item { MPC.Equip(E); transform.parent.parent.Find("EquippedSlotButtons/" + (int)E.EquipType).GetComponent <EquippedButtonController>().UpdateSlot(); MPC.RemoveFromInventory(Slot); UpdateSlot(); EI.Show(E, EquipmentInfo.Mode.Inventory); } } else { RedNotification.Push(RedNotification.Type.CANT_EQUIP); } } }
public void OnClickUnEquip() { if (!MPC.GetEquippedItem(Slot).isNull) { if (MPC.InventoryIsFull()) //Inventory Full { RedNotification.Push(RedNotification.Type.INVENTORY_FULL); return; } else { int SlotIndex = MPC.FirstAvailbleInventorySlot; MPC.AddToInventory(SlotIndex, E); transform.parent.parent.Find("InventoryButtons/" + SlotIndex).GetComponent <InventoryButtonController>().UpdateSlot(); MPC.UnEquip(Slot); UpdateSlot(); EI.Show(E, EquipmentInfo.Mode.Equipped); } } }