コード例 #1
0
 public void DropItem()
 {
     if (_selectedInvSlot != null && _selectedInvSlot.IsOccupied)
     {
         if (_selectedInvSlot.InvSlotContent.Resource)
         {
             GameObject ResourceDrop = Instantiate(ResourceDropPrefab, Player.transform.position, Quaternion.identity);
             ResourceDrop.GetComponent <ResourceDrop>().Type     = _selectedInvSlot.InvSlotContent.ResourceDrop.Type;
             ResourceDrop.GetComponent <ResourceDrop>().Amount   = _selectedInvSlot.InvSlotContent.Amount;
             ResourceDrop.GetComponent <SpriteRenderer>().sprite = Resources.Load <Sprite>("Sprites/" + _selectedInvSlot.InvSlotContent.IconName);
             UpdatePlayerResources(-1, _selectedInvSlot.InvSlotContent.ResourceDrop.Type);
         }
         else if (_selectedInvSlot.InvSlotContent.IsItem)
         {
             GameObject itemDrop = Instantiate(ItemDropPrefab, Player.transform.position, Quaternion.identity);
             itemDrop.GetComponent <ItemDrop>().Type         = _selectedInvSlot.InvSlotContent.Item.Type;
             itemDrop.GetComponent <ItemDrop>().Item         = _selectedInvSlot.InvSlotContent.Item;
             itemDrop.GetComponent <ItemDrop>().Name         = _selectedInvSlot.InvSlotContent.Name;
             itemDrop.GetComponent <ItemDrop>().IconName     = _selectedInvSlot.InvSlotContent.IconName;
             itemDrop.GetComponent <SpriteRenderer>().sprite = Resources.Load <Sprite>("Sprites/" + _selectedInvSlot.InvSlotContent.IconName);
             Player.AllItems.Remove(_selectedInvSlot.InvSlotContent.Item);
             _selectedInvSlot.ResetInvSlot();
             Player.DamageValue = Player.BasicDamageValue;
             CancelItemOnMapPreshow();
         }
     }
 }
コード例 #2
0
ファイル: Inventory.cs プロジェクト: AArtlone/IslandQuest
    public void FillUpBucket()
    {
        HandEquipment.ResetInvSlot();
        InvSlotContent content = new InvSlotContent(FullBucket);

        AssigHandEquipment(content);
    }
コード例 #3
0
 private void UnEquipBody()
 {
     if (IsInventoryFull())
     {
         DropItem();
     }
     else
     {
         AddItem(_bodyEquipment.InvSlotContent);
         _bodyEquipment.ResetInvSlot();
     }
     ToggleBlockIcon(false);
 }
コード例 #4
0
ファイル: Inventory.cs プロジェクト: AArtlone/IslandQuest
    private void SwapItems(InvSlot invSlot, string bodyPart)
    {
        InvSlotContent tempInvSlotContent = invSlot.InvSlotContent;

        invSlot.ResetInvSlot();
        if (bodyPart == "Body")
        {
            AssignBodyEquipment();
        }
        else if (bodyPart == "Hand")
        {
            AssigHandEquipment();
        }
        AddItem(tempInvSlotContent);
    }
コード例 #5
0
ファイル: Inventory.cs プロジェクト: AArtlone/IslandQuest
 private void UnEquipBody()
 {
     if (IsInventoryFull())
     {
         DropItem();
     }
     else
     {
         AddItem(BodyEquipment.InvSlotContent);
         BodyEquipment.ResetInvSlot();
         Player.DamageValue = Player.BasicDamageValue;
         ToggleBlockIcon(false);
         ToggleInvHint(false);
         CancelShieldOnMapPreshow();
     }
 }