//private void BeginDrag(ItemSlot itemSlot) //{ // if (itemSlot.Item != null) // { // draggedSlot = itemSlot; // draggableItem.sprite = draggedSlot.Item.Icon; // draggableItem.transform.position = Input.mousePosition; // draggableItem.enabled = true; // if(itemSlot.Item is EquippableItem) // for(int i=0; i<EquipmentPanel.quip // //destinationSlot = itemSlot. // // destinationSlotImage.color = destinationHighlight; // } //} //private void EndDrag(ItemSlot itemSlot) //{ // draggedSlot = null; // draggableItem.enabled = false; // //destinationSlotImage.color = destinationNormal; //} //private void Drag(ItemSlot itemSlot) //{ // if (draggableItem.enabled) // { // draggableItem.transform.position = Input.mousePosition; // } //} //private void Drop(ItemSlot dropItemSlot) //{ // if (dropItemSlot.CanReceiveItem(draggedSlot.Item) && draggedSlot.CanReceiveItem(dropItemSlot.Item)) // { // EquippableItem dragItem = draggedSlot.Item as EquippableItem; // EquippableItem dropItem = dropItemSlot.Item as EquippableItem; // if (draggedSlot is EquipmentSlot) // { // if (dragItem != null) dragItem.Unequip(this); // if (dropItem != null) // { // nextTable = dropItem.NextTable; // familyTree = dropItem.Family; // archetype.nextButton.enabled = true; // dropItem.Equip(this); // } // } // if (dropItemSlot is EquipmentSlot) // { // if (dragItem != null) // { // nextTable = dragItem.NextTable; // familyTree = dragItem.Family; // archetype.nextButton.enabled = true; // } // dragItem.Equip(this); // if (dropItem != null) // { // nextTable = dropItem.NextTable; // familyTree = dropItem.Family; // archetype.nextButton.enabled = true; // dropItem.Unequip(this); // } // } // statPanel.UpdateStatValues(); // advantagePanel.UpdateStatValues(); // skillPanel.UpdateStatValues(); // Item draggedItem = draggedSlot.Item; // draggedSlot.Item = dropItemSlot.Item; // dropItemSlot.Item = draggedItem; // } //} public void Equip(EquippableItem item) { if (archetype.RemoveItem(item)) { EquippableItem previousItem; if (equipmentPanel.AddItem(item, out previousItem)) { if (previousItem != null) { archetype.AddItem(previousItem); previousItem.Unequip(this); statPanel.UpdateStatValues(); } item.Equip(this); lastItem = item; lastItemString = item.ToString(); //previousTable = item.Parent; nextTable = item.NextTable; familyTree = item.Family; subFamily = item.subFamily; archetype.nextButton.enabled = true; statPanel.UpdateStatValues(); advantagePanel.UpdateStatValues(); skillPanel.UpdateStatValues(); powerPanel.UpdateStatValues(); } else { archetype.AddItem(item); } } }