Esempio n. 1
0
    private void TakeItem()
    {
        Debug.Log("Take item");
        ItemListEntry item = convoy.GetEntry();

        if (!item)
        {
            return;
        }

        InventoryContainer invCon = charList.GetEntry().invCon;

        if (!invCon.AddItem(playerData.items[item.index]))
        {
            prompt.ShowOkPopup("Inventory is full!");
            currentMode = State.MENU;
            return;
        }
        convoy.RemoveEntry();
        playerData.items.RemoveAt(item.index);

        ShowCharInfo();
        ShowCharInfoTake();
        ShowItemInfo();
    }
Esempio n. 2
0
 public static void MoveItemTo(Item i, InventoryContainer c, Vector2 slot, bool swapAllowed = true)
 {
     if (c.GetItem(slot) != null && swapAllowed)
     {
         AttemptSwap(i, c.GetItem(slot).EquipmentInstance);
     }
     c.ClearItem(slot);
     c.AddItem(i, slot);
 }
        public void ParentIsAssignedCorrectly()
        {
            IInventoryItem backpack = new InventoryContainer("Backpack", 100);
            IInventoryItem sword    = new Sword("Masamune", 50);

            backpack.AddItem(sword);

            Assert.IsTrue(sword.Parent == backpack);
        }
        public void AddLeafItemSucceeds()
        {
            IInventoryItem backpack = new InventoryContainer("Backpack", 100);
            IInventoryItem sword    = new Sword("Masamune", 50);

            backpack.AddItem(sword);

            Assert.IsTrue(backpack.Contains(sword));
        }
        public void AddCompositeItemSucceeds()
        {
            IInventoryItem backpack = new InventoryContainer("Backpack", 100);

            IInventoryItem spellBook = new UniqueInventoryContainer("Spellbook", 100);

            backpack.AddItem(spellBook);

            IInventoryItem fireball = new Spell("Fireball", 100);

            spellBook.AddItem(fireball);

            Assert.IsTrue(backpack.Contains(spellBook));
            Assert.IsTrue(spellBook.Contains(fireball));
        }
Esempio n. 6
0
    private void TakeItem()
    {
        ItemListEntry item = convoy.GetEntry();

        if (!item)
        {
            return;
        }
        Debug.Log("Take item");

        InventoryContainer invCon = characters.GetEntry().invCon;

        if (!invCon.AddItem(playerData.items[item.index]))
        {
            restockPrompt.ShowOkPopup("Inventory is full!");
            promptMode = true;
            return;
        }
        convoy.RemoveEntry();
        playerData.items.RemoveAt(item.index);

        ShowCharInfo();
    }
Esempio n. 7
0
 public void AddItem(Item i, ItemUIElement iue)
 {
     m_container.AddItem(i, Coordinate);
 }
Esempio n. 8
0
 public void AddItem(Item i)
 {
     m_container.AddItem(i, Coordinate);
 }