Пример #1
0
    public void Delete()
    {
        if (playerData.WeaponCount() <= 1)
        {
            return;
        }

        playerData.ClearSlot(weapon.bodySlot, false);

        playerData.RemoveWeapon(selectedWeapon);
        Destroy(weaponPanels[selectedWeapon]);
        weaponPanels.RemoveAt(selectedWeapon);

        if (selectedWeapon >= playerData.WeaponCount())
        {
            SetSelected(playerData.WeaponCount() - 1, false);
        }
        else
        {
            SetSelected(selectedWeapon, false);
        }

        uiWeaponPartList.UpdatePanels();

        UiWeaponStats.UpdateStats();
    }
Пример #2
0
    public void GetItems()
    {
        for (int i = 0; i < numItems; i++)
        {
            PlayerData.instance.AddPart(WeaponParts.GetRandomPart(PlayerData.instance.level));
        }

        uiWeaponPartList.UpdatePanels();
    }
Пример #3
0
    /// <summary>
    /// Remove the object in the given indices
    /// </summary>
    /// <param name="indices">The indeces in which the object is stored</param>
    public override void RemoveObject(int[] indices)
    {
        // Check the indices
        if (indices.Length == 1 && indices[0] == 0)
        {
            // Remove the object
            panel.SetObject(null);

            if (slot.part != null)
            {
                PlayerData.instance.ClearSlot(slot);

                if (uiWeaponPartList != null)
                {
                    uiWeaponPartList.UpdatePanels();
                }
            }
        }
    }