コード例 #1
0
        public void EquipConsumable(ConsumableItem consumable, EquipmentSlotEnum equipmentSlotID)
        {
            MoveConsumableBackToInventory(equipmentSlotID);
            SetConsumableInSlot(consumable, equipmentSlotID);

            UpdateConsumableSlots();
        }
コード例 #2
0
        private void MoveConsumableBackToInventory(EquipmentSlotEnum equipmentSlotID)
        {
            ConsumableItem equippedConsumable = GetEquippedConsumable(equipmentSlotID);

            if (equippedConsumable != null)
            {
                consumablesInInventory.Add(equippedConsumable);
            }
        }
コード例 #3
0
 private void LoadConsumables()
 {
     foreach (ConsumableEquipmentSlot slot in consumableEquipmentSlots)
     {
         ConsumableItem consumable = playerInventory.GetEquippedConsumable(slot.equipmentSlotID);
         if (consumable != null)
         {
             slot.AddItem(consumable);
         }
     }
 }
コード例 #4
0
        public void AddItem(ConsumableItem newConsumable)
        {
            if (newConsumable == null)
            {
                return;
            }

            consumable   = newConsumable;
            icon.sprite  = consumable.icon;
            icon.enabled = true;
        }
コード例 #5
0
 private void HandleUseItemInput()
 {
     if (useItem_Input)
     {
         if (!playerManager.isInteracting)
         {
             ConsumableItem equippedConsumable = playerInventory.consumable;
             consumableSlotManager.UseConsumable(equippedConsumable);
         }
     }
 }
コード例 #6
0
 public void UpdateConsumableUI(ConsumableItem consumable)
 {
     if (consumable == null)
     {
         consumableIcon.sprite  = null;
         consumableIcon.enabled = false;
     }
     else
     {
         consumableIcon.sprite  = consumable.icon;
         consumableIcon.enabled = consumable.icon != null;
     }
 }
コード例 #7
0
        private void SetConsumableInSlot(ConsumableItem consumable, EquipmentSlotEnum equipmentSlotID)
        {
            switch (equipmentSlotID)
            {
            case EquipmentSlotEnum.ConsumableSlot01:
                equippedConsumables[0] = consumable;
                break;

            case EquipmentSlotEnum.ConsumableSlot02:
                equippedConsumables[1] = consumable;
                break;

            case EquipmentSlotEnum.ConsumableSlot03:
                equippedConsumables[2] = consumable;
                break;

            case EquipmentSlotEnum.ConsumableSlot04:
                equippedConsumables[3] = consumable;
                break;

            case EquipmentSlotEnum.ConsumableSlot05:
                equippedConsumables[4] = consumable;
                break;

            case EquipmentSlotEnum.ConsumableSlot06:
                equippedConsumables[5] = consumable;
                break;

            case EquipmentSlotEnum.ConsumableSlot07:
                equippedConsumables[6] = consumable;
                break;

            case EquipmentSlotEnum.ConsumableSlot08:
                equippedConsumables[7] = consumable;
                break;
            }

            if (consumable != null)
            {
                consumablesInInventory.Remove(consumable);
            }
        }
コード例 #8
0
 public override void UnequipItem()
 {
     consumable = null;
     base.UnequipItem();
 }
コード例 #9
0
 private void UpdateConsumableSlots()
 {
     consumable = equippedConsumables[currentConsumableIndex];
     consumableSlotManager.LoadConsumableOnQuickSlot(consumable);
 }
コード例 #10
0
 public void AddItem(ConsumableItem newItem)
 {
     consumable = newItem;
     base.AddItem(newItem);
 }
コード例 #11
0
 public override void ClearInventorySlot()
 {
     consumable = null;
     base.ClearInventorySlot();
 }
コード例 #12
0
 public void UseConsumable(ConsumableItem consumable)
 {
     weaponSlotManager.UnloadWeaponOnSlot(WeaponSlotID.RightHandSlot);
     consumableSlot.LoadConsumableModel(consumable);
     animator.PlayTargetAnimation(consumable.useAnimation, true);
 }
コード例 #13
0
 public void LoadConsumableOnQuickSlot(ConsumableItem consumable)
 {
     quickSlotsUI.UpdateConsumableUI(consumable);
 }
コード例 #14
0
 public void LoadConsumableModel(ConsumableItem consumable)
 {
     LoadItemModel(consumable);
     currentConsumable = consumable;
 }