示例#1
0
    /// <summary>
    /// Method that will remove the interactibles from the inventory
    /// </summary>
    /// <param name="interType"></param>
    private void RemoveFromInventory(InteractibleType interType)
    {
        Interactible inter = _inventory.Find(it => it.type == interType);

        if (inter != null)
        {
            _inventory.Remove(inter);
        }

        // Calls UpdateInventoryIcons
        UpdateInventoryIcons();
    }
示例#2
0
    /// <summary>
    /// Bool that will check if the player has an interactible on the inventory
    /// </summary>
    /// <param name="pickable"></param>
    /// <returns></returns>
    private bool HasInInventory(InteractibleType pickable)
    {
        foreach (Interactible item in _inventory)
        {
            if (item.type == pickable)
            {
                return(true);
            }
        }

        return(false);
    }
示例#3
0
    /// <summary>
    /// Bool that will check if the player has an interactible on the inventory
    /// </summary>
    /// <param name="pickable"></param>
    /// <param name="nRequirements"></param>
    /// <returns></returns>
    public bool HasInInventory(InteractibleType pickable, int nRequirements)
    {
        if (_inventory.Count < nRequirements)
        {
            return(false);
        }

        int n = 0;

        for (int i = 0; i < _inventory.Count; i++)
        {
            if (_inventory[i].type == pickable)
            {
                n++;
                if (n >= nRequirements)
                {
                    return(true);
                }
            }
        }

        return(false);
    }