//delete item from slot, and destroy dragItem gameObjec private void removeItemFromSlot(SlotControllerScript slot) { var dragItem = slot.dragItem; if (dragItem != null) { draggableItemList.Remove(dragItem); slot.dragItem = null; Destroy(dragItem.gameObject); } }
private void rightClickWeapon(SlotControllerScript slot) { if (slot is WeaponSlotControllerScript) { //do nothing if we're already an weapon slot return; } else { var dragItem = slot.getItem(); var weaponSlot = dragAndDropScript.weaponSlot; var curWeapon = weaponSlot.getItem(); if (curWeapon != null) { //switch items slot.addItem(curWeapon); } weaponSlot.addItem(dragItem); } }
private void rightClickArmor(SlotControllerScript slot) { if (slot is EquipmentSlotControllerScript) { Debug.Log("right clicked equip slot"); //do nothing if we're already an equipment slot return; } else { var dragItem = slot.getItem(); Armor a = (Armor)dragItem.item; var equipSlot = dragAndDropScript.equipmentDictionary [a.armorType]; var curEquipItem = equipSlot.getItem(); if (curEquipItem != null) { //switch items slot.addItem(curEquipItem); } equipSlot.addItem(dragItem); } }
public void addToSlot(SlotControllerScript slot) { Debug.Log("Adding " + item.name + " to " + slot.gameObject.name); this.lastSlot = slot; this.gameObject.transform.position = slot.gameObject.transform.position; }
private bool addItemToSlot(SlotControllerScript slot, DragItemControllerScript dragItem) { return(slot.addItem(dragItem)); }