Example #1
0
    /// <summary>
    /// Handles getting input from inventory.
    /// </summary>
    /// <param name="IN_INV"></param>
    public void InputFromInventory(IInventory IN_INV)
    {
        //Find the item we would extract if it is possible.
        GenericItem EXTRACT_CANDIDATE = IN_INV.AttemptExtractItem();

        Debug.Log(EXTRACT_CANDIDATE);

        //If we have a candidate, try to add it.
        if (EXTRACT_CANDIDATE != null)
        {
            //Attempt to add item.
            int remainder = INV.AddSingleItem(EXTRACT_CANDIDATE);

            //If remainder is 0, it succeeded. Actually decrement target inventory now.
            if (remainder == 0)
            {
                IN_INV.ExtractSingleItem(EXTRACT_CANDIDATE);
            }
        }
        EXTRACT_TIMER = (1 / EXTRACT_SPEED) / 2;
    }