예제 #1
0
        private void EquipItem(Item item, ClearSlotCallback clearSlotCallback)
        {
            if (item != null)
            {
                Eq eq = this.gameObject.GetComponentInParent <EqInventory>().ChampionEquipment;

                if (item is EquipmentItem)
                {
                    EquipmentItem equipmentItem = (EquipmentItem)item;

                    if (equipmentItem.IsEquiped)
                    {
                        //remove from equipment
                        Item tempItem = eq.RemoveFromEQ(equipmentItem.EquipmentType);
                        if (tempItem != null)
                        {
                            this.AddItem(tempItem);
                        }
                    }
                    else
                    {
                        //add or swap item in equipment

                        if (eq.AddToEQ(equipmentItem, equipmentItem.EquipmentType))
                        {
                            this.DeleteFromBagpack(item);
                            clearSlotCallback();
                        }


                        //swap if we have item
                        if (eq.IsIHaveItemToSwap)
                        {
                            Item swapItem = eq.GetSwapItem();
                            this.AddItem(swapItem);
                            //this.ReloadBagpack();
                        }
                    }
                }
            }
        }
예제 #2
0
 private void SetUpBagpacks()
 {
     this.PlayerBagpack     = this.gameObject.GetComponentInChildren <Bagpack>();
     this.ChampionEquipment = this.gameObject.GetComponentInChildren <Eq>();
 }