public void Equip(EquippableItem item, int checkDB) { if (checkDB == 0) { if (inventory.RemoveItem(item)) { EquippableItem previousItem; if (equipmentPanel.AddItem(item, out previousItem, 1)) { if (previousItem != null) { inventory.AddItem(previousItem); previousItem.Unequip(this); statPanel.UpdateStatValues(); } item.Equip(this); statPanel.UpdateStatValues(); } else { inventory.AddItem(item); } } } else { EquippableItem previousItem; if (equipmentPanel.AddItem(item, out previousItem, 0)) { item.Equip(this); statPanel.UpdateStatValues(); } } }
public void Equip(EquippableItem item) { item.EnchantLvl = dragItemSlot.Enchant; if (Inventory.RemoveItem(item)) { EquippableItem previousItem; if (EquipmentPanel.AddItem(item, out previousItem)) { if (previousItem != null) { Inventory.AddItem(previousItem); previousItem.Unequip(this); statPanel.UpdateStatValues(); } item.Equip(this); CharacterManager.Instance.EquipItem(WorldManager.Instance.activeCharacter, item.itemId); statPanel.UpdateStatValues(); } else { Inventory.AddItem(item); } } }
public void Equip(Equippable pItem) { //Try removing the item from inventory if (_inventory.RemoveItem(pItem)) { //Add it to the equipment panel Equippable previousItem; if (_equipmentPanel.AddItem(pItem, out previousItem)) { //If the slot was already taken, return the other item in the inventory if (previousItem != null) { previousItem.Unequip(this); _statsPanel.UpdateStatValues(); _inventory.AddItem(previousItem); } pItem.Equip(this); _statsPanel.UpdateStatValues(); } else { //If for some reason the item couldn't be equipped return it back in the inventory _inventory.AddItem(pItem); } } }
public void Equip(EquipableItem item) { if (Inventory.RemoveItem(item)) { EquipableItem previousItem; if (EquipmentPanel.AddItem(item, out previousItem)) { if (previousItem != null) { Inventory.AddItem(previousItem); previousItem.Unequip(this); statPanel.UpdateStatValues(); } item.Equip(this); statPanel.UpdateStatValues(); if (item.equipmentType == EquipmentType.Weapon) { string[] name = item.ItemName.Split(' '); if (name[0] == "Sword" || name[0] == "Staff" || name[0] == "Bow") { player.SwapWeapons(name[0]); } else { player.SwapWeapons(name[1]); } } } else { Inventory.AddItem(item); } } }
/// <summary> /// 아이템 장착 /// </summary> /// <param name="item">장착할 아이템</param> public void Equip(EquippableItem item) { if (inventory.RemoveItem(item)) { EquippableItem previosuItem; // 이전에 장착했던 아이템을 받을 변수 if (equipmentPanel.AddItem(item, out previosuItem)) { // 장착 했던 아이템이 있을 경우 인벤토리에 추가함 if (previosuItem != null) { inventory.AddItem(previosuItem); previosuItem.Unequip(this); // 장착 해체 후 스텟 반영 statsPanel.UpdateStatValues(); } item.Equip(this); // 장비한 아이템 스텟 반영 statsPanel.UpdateStatValues(); // 스텟 창 값 갱신 SetStats(); } // 장착 실패 -> 인벤토리로 돌려 보냄 else { inventory.AddItem(item); } } }
public void Equip(sEquippableItem _item) { if (inventory.RemoveItem(_item)) // if the item is able to be removed from the inventory { sEquippableItem previousItem; // reference for the previous item if (equipPanel.AddItem(_item, out previousItem)) // if we can add the item to the equipment panel { if (previousItem != null) // if there was an item in the equipment slot before adding this one { inventory.AddItem(previousItem); // add the previous item in the slot back in to the inventory previousItem.Unequip(this); statPanel.UpdateStatValues(); } _item.Equip(this); statPanel.UpdateStatValues(); } else { Debug.Log("Can not equip this item here!"); inventory.AddItem(_item); // if we can't add the item to an equipment slot, return it to the inventory } } }
public void Equip(EquippableItem item) { Debug.Log("EQUIPU!"); if (Inventory.RemoveItem(item)) { Debug.Log("REMOVEU ITEM INVETARIO"); EquippableItem previousItem; if (EquipmentPanel.AddItem(item, out previousItem)) { if (previousItem != null) { Inventory.AddItem(previousItem); previousItem.Unequip(this); statPanel.UpdateStatValues(); } item.Equip(this); statPanel.UpdateStatValues(); } else { Debug.Log("ADD ITEM"); Inventory.AddItem(item); } } }
public void Equip(sEquipment _item) { Debug.Log("Equipping " + _item.name); sEquipment previousItem; if (equipmentPanel.AddItem(_item, out previousItem)) { if (previousItem != null) { //TODO: potentially just destroy the item here instead //inventory.AddItem(previousItem); //previousItem.Unequip(this); statPanel.UpdateStatValues(); } _item.Equip(this); statPanel.UpdateStatValues(); Debug.Log("Added " + _item.name); } else { inventory.AddItem(_item); } }
//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); } } }
private void SwapItem(ItemSlot dropItemSlot) { var DragItem = m_DraggedSlot.Item; int DragAmount = m_DraggedSlot.Amount; var DropItem = m_DropedItemSlot.Item; int DropAmount = m_DropedItemSlot.Amount; List <Item> preItems = new List <Item>(); if (m_DraggedSlot as EquipmentSlot != null) { //equipment slot if (m_DropedItemSlot.Item != null) { equipmentPanel.AddItem((EquipableItem)DropItem, DropAmount, out preItems); } else { equipmentPanel.RemoveItem((EquipableItem)DragItem, out preItems); } inventory.AddItem(DragItem, m_DropedItemSlot.Id, DragAmount); DropInWorldChest(inventory.AddItem(preItems)); } else if (m_DropedItemSlot as EquipmentSlot != null) { //inventory slot if (m_DropedItemSlot.Item != null) { inventory.AddItem(DropItem, m_DraggedSlot.Id, DropAmount); } else { inventory.RemoveItem(m_DraggedSlot.Id, DragAmount); } equipmentPanel.AddItem((EquipableItem)DragItem, DragAmount, out preItems); DropInWorldChest(inventory.AddItem(preItems)); } else { m_DropedItemSlot.Item = DragItem; m_DropedItemSlot.Amount = DragAmount; m_DraggedSlot.Item = DropItem; m_DraggedSlot.Amount = DropAmount; } }
//Removes inputted item from inventory and adds it to equip panel public void Equip(Item item) { //If you can remove the part if (inventory.RemoveItem(item) && item != null) { //If you can add it to the equipped if (equipmentPanel.AddItem(item, out var previousItem)) { //if equipped is full and it swaps items if (previousItem != null) { inventory.AddItem(previousItem); Unequip(previousItem); } currentBot.AddPart(item.Part); RefreshBotInfo(); CreateAllBotImages(); } else { inventory.AddItem(item); } } }
public void Equip(GenericItem item) { if (inventory.RemoveItem(item)) { GenericItem previousItem; if (equipmentPanel.AddItem(item, out previousItem)) { if (previousItem != null) { inventory.AddItem(previousItem); } } else { inventory.AddItem(item); } } }
public void Equip(EquippableItem item) { EquippableItem previousItem; if (equipmentPanel.AddItem(item, out previousItem)) { if (previousItem != null) { previousItem.UnEquip(this); } item.Equip(this); wearInfoDisplay.UpdateStatusInfo(); } else { inventory.AddItem(item); } }
public void Equiping(EquipableItem itemSlot) { if (inventory.RemoveItem(itemSlot)) { EquipableItem itemInSlot; if (equipmentPanel.AddItem(itemSlot, out itemInSlot)) { if (itemInSlot != null) { inventory.AddItem(itemInSlot); itemInSlot.Unequip(this); } itemSlot.Equip(this); } else { Inventory.instance.AddItem(itemSlot); } } }
public void Equip(EquippableItem item) { if (Inventory.RemoveItem(item)) { EquippableItem previousItem; if (EquipmentPanel.AddItem(item, out previousItem)) { if (previousItem != null) { Inventory.AddItem(previousItem); previousItem.Unequip(this); } item.Equip(this); } else { Inventory.AddItem(item); } } }
public void Equip(EquippableItem item) { if (inventory.RemoveItem(item)) { EquippableItem previousItem; if (equipmentPanel.AddItem(item, out previousItem)) { if (previousItem != null) { inventory.AddItem(previousItem); previousItem.UnEquip(this); //statPanel.UpdateStatValues(); } item.Equip(this); //statPanel.UpdateStatValues(); } else { inventory.AddItem(item); } } }
public void Equip(EquippableItem item) { if (inventory.RemoveItem(item)) { EquippableItem previousItem; if (equipmentPanel.AddItem(item, out previousItem)) { if (previousItem != null) { inventory.AddItem(previousItem); previousItem.Unequip(this); } item.Equip(this); //裝備武器時同步到玩家手上 20190313 if (item.equipmentType == EquipmentType.武器) { Object obj = Resources.Load(item.ItemName); GameObject gobj = Instantiate(obj) as GameObject; gobj.tag = "Player"; gobj.transform.parent = Hand.transform; gobj.transform.position = Hand.transform.position; gobj.transform.rotation = Hand.transform.rotation; if (WeaponInHandEvent != null) { WeaponInHandEvent(); } } } else { inventory.AddItem(item); } } }
public void Equip(EquippableItem item) { //We'll want to add a way to equip items from anywhere and not just the inventory if (inventory.RemoveItem(item)) { EquippableItem previousItem; if (equipmentPanel.AddItem(item, out previousItem)) { if (previousItem != null) { inventory.AddItem(previousItem); previousItem.Unequip(player); statPanel.UpdateStatValues(); } item.Equip(player); statPanel.UpdateStatValues(); } else { inventory.AddItem(item); } } }
public void Equip(EquippableItem item) { if (Inventory.RemoveItem(item)) { EquippableItem previousItem; if (EquipmentPanel.AddItem(item, out previousItem)) { if (previousItem != null) { Inventory.AddItem(previousItem); previousItem.Unequip(this); statPanel.UpdateStatValues(); } item.Equip(this); UpdateEquipItemController(item); statPanel.UpdateStatValues(); } else { Inventory.AddItem(item); } } }
public void Equip(EquippableItem item) { if (inventory.RemoveItem(item)) //Remove item from inventory { EquippableItem previousItem; if (equipmentPanel.AddItem(item, out previousItem)) //Add to equipment panel { if (previousItem != null) //Equipment slot already occupied { inventory.AddItem(previousItem); //Return it back to inventory previousItem.Unequip(this); statPanel.UpdateStatValues(); } item.Equip(this); statPanel.UpdateStatValues(); //Update the values } else { inventory.AddItem(item); //Can't be equipped = return to inventory } } }
public void Equip(EquippableItems item) { if (inventory.RemoveItem(item)) { EquippableItems PreviousItem; if (equipmentPanel.AddItem(item, out PreviousItem)) { if (PreviousItem != null) { /* * SM.Strength -= PreviousItem.Strength; * SM.Intelligance -= PreviousItem.Intelligance; * SM.Stamina -= PreviousItem.Stamina; * SM.Agility -= PreviousItem.Agility; * SM.WeapPhysicalDamage -= PreviousItem.PhysicalDamage; * SM.WeapMagicDamage -= PreviousItem.MagicDamage; * playerRef.MaxHealth -= StrengthToAdd; * playerRef.MaxMana -= IntelligenceToAdd; * playerRef.MaxStamina -= StaminaToAdd; */ UnEquip(PreviousItem); //item.Equipped = false; //inventory.AddItem(PreviousItem); } item.ApplyStats(); /* * SM.Strength += item.Strength; * SM.Intelligance += item.Intelligance; * SM.Stamina += item.Stamina; * SM.Agility += item.Agility; * SM.WeapPhysicalDamage += item.PhysicalDamage; * SM.WeapMagicDamage += item.MagicDamage; * StrengthToAdd = item.Strength * 10; * playerRef.MaxHealth += StrengthToAdd; * IntelligenceToAdd = item.Intelligance * 10; * playerRef.MaxMana += IntelligenceToAdd; * StaminaToAdd = item.Stamina * 10; * playerRef.MaxStamina += StaminaToAdd; */ item.Equipped = true; if (item.weaponType == WeaponType.Sword) { SwordRef.SetActive(true); Player.Weapon = EquippedWeapon.Melee; //SM.MagicWeaponEquipped = false; //SM.PhysicalWeaponEquipped = true; //UI.CheckIcons(); //MagicWeapRef.SetActive(false); } else if (item.weaponType == WeaponType.Bow) { BowRef.SetActive(true); Player.Weapon = EquippedWeapon.Bow; //SM.MagicWeaponEquipped = true; //SM.PhysicalWeaponEquipped = false; //UI.CheckIcons(); //SwordRef.SetActive(false); } } else { inventory.AddItem(item); return; } inventory.RefreshUI(); } }
public void Equip(EquippableItems item) { if (inventory.RemoveItem(item)) { EquippableItems PreviousItem; if (equipmentPanel.AddItem(item, out PreviousItem)) { if (PreviousItem != null) { SM.Strength -= PreviousItem.Strength; SM.Intelligance -= PreviousItem.Intelligance; SM.Stamina -= PreviousItem.Stamina; SM.Agility -= PreviousItem.Agility; SM.WeapPhysicalDamage -= PreviousItem.PhysicalDamage; SM.WeapMagicDamage -= PreviousItem.MagicDamage; playerRef.MaxHealth -= StrengthToAdd; playerRef.MaxMana -= IntelligenceToAdd; playerRef.MaxStamina -= StaminaToAdd; item.Equipped = false; inventory.AddItem(PreviousItem); } SM.Strength += item.Strength; SM.Intelligance += item.Intelligance; SM.Stamina += item.Stamina; SM.Agility += item.Agility; SM.WeapPhysicalDamage += item.PhysicalDamage; SM.WeapMagicDamage += item.MagicDamage; StrengthToAdd = item.Strength * 10; playerRef.MaxHealth += StrengthToAdd; IntelligenceToAdd = item.Intelligance * 10; playerRef.MaxMana += IntelligenceToAdd; StaminaToAdd = item.Stamina * 10; playerRef.MaxStamina += StaminaToAdd; item.Equipped = true; if (item.weaponType == WeaponType.Sword) { SwordRef.SetActive(true); SM.MagicWeaponEquipped = false; SM.PhysicalWeaponEquipped = true; UI.CheckIcons(); MagicWeapRef.SetActive(false); } if (item.weaponType == WeaponType.MagicWeap) { MagicWeapRef.SetActive(true); SM.MagicWeaponEquipped = true; SM.PhysicalWeaponEquipped = false; UI.CheckIcons(); SwordRef.SetActive(false); } } else { inventory.AddItem(item); } } UI.UpdateStats(); UI.UpdatePlayerBars(); }