示例#1
0
    /// <summary>
    /// Get a list of each kind of unique gear piece in the inventory.
    /// Duplicate pieces aren't shown
    /// </summary>
    /// <returns></returns>
    public List <GearData> GetAllGearTypes()
    {
        List <GearData> output = new List <GearData>();

        foreach (KeyValuePair <int, int> pair in contents)
        {
            output.Add(GearDatabase.GetGearDataByID(pair.Key));
        }
        return(output);
    }
示例#2
0
    /// <summary>
    /// Get a list of each kind of unique gear piece in the inventory that fits in a given slot
    /// </summary>
    /// <param name="slotFilter">The requiredSlot to filter for</param>
    /// <returns></returns>
    public List <GearData> GetAllGearTypesOfSlot(GearSlotTypes slotFilter)
    {
        List <GearData> output = new List <GearData>();

        foreach (KeyValuePair <int, int> pair in contents)
        {
            GearData gear = GearDatabase.GetGearDataByID(pair.Key);
            if (gear.requiredSlot == slotFilter)
            {
                output.Add(gear);
            }
        }
        return(output);
    }
    void Start()
    {
        CardDatabase.LoadAllCards();
        GearDatabase.LoadAllGear();

        if (GameplayContext.CurrentInventory is null || GameplayContext.RequestReset)
        {
            playerInventory = new InventoryCollection();
            //two legs
            playerInventory.AddItem(GearDatabase.GetGearDataByID(0));
            playerInventory.AddItem(GearDatabase.GetGearDataByID(0));
            //two melee arm
            playerInventory.AddItem(GearDatabase.GetGearDataByID(1), 2);
            //two rifle arm
            playerInventory.AddItem(GearDatabase.GetGearDataByID(3), 2);
            GameplayContext.CurrentInventory = playerInventory;
            Debug.Log("made new inventory");
        }