Beispiel #1
0
    private void CreateCraftedItem(Transform newSlot)
    {
        BasePickableItem item = (BasePickableItem)GameAccesPoint.Instance.mainGameState._gameItemDatabase.CreateItem(creatableItems[recipeIndex - 1], dropAnchor.position, Quaternion.identity);

        item.SetVisualState(false);

        _inventory[newSlot] = new InventoryItem(item, currentTmpVisual);

        currentTmpVisual = null;
        ConsumeCraftItems();
    }
Beispiel #2
0
    private void RecreateInventory(SavableInventory savedInventory)
    {
        Debug.Log("Recreating inventory");

        List <int>    keys   = savedInventory.inventoryKeys;
        List <string> values = savedInventory.inventoryValues;

        for (int i = 0; i < keys.Count; i++)
        {
            if (!string.IsNullOrEmpty(values[i]))
            {
                BaseItem item = GameAccesPoint.Instance.mainGameState._gameItemDatabase.CreateItemInstance(values[i], Vector3.zero, Quaternion.identity);
                if (item is BasePickableItem)
                {
                    BasePickableItem pickableItem = (BasePickableItem)item;
                    pickableItem.SetVisualState(false);
                    AddItem(pickableItem, pickableItem.myIcon, i);
                }
            }
        }
    }