Пример #1
0
    private static void EquipSelected()
    {
        Loot lt = inventoryTable.RetrieveHighlight <Loot>();

        Player.ItemSlot itms          = null;
        bool            rightHandFlag = false;

        switch (equipmentHighlight.Text)
        {
        case "Head":
            itms = Player.instance.equipment.head; break;

        case "Chest":
            itms = Player.instance.equipment.chest; break;

        case "Right Hand":
            itms = Player.instance.equipment.rHand; rightHandFlag = true; break;

        case "Left Hand":
            itms = Player.instance.equipment.lHand; break;

        case "Right arm":
            itms = Player.instance.equipment.rArm; break;

        case "Left arm":
            itms = Player.instance.equipment.lArm; break;

        case "Right leg":
            itms = Player.instance.equipment.rLeg; break;

        case "Left leg":
            itms = Player.instance.equipment.lLeg; break;

        default:
            throw new Exception("Stupid shit in equipment");
        }
        if (lt.slot == itms.slot)
        {
            if (itms.item != null)
            {
                Player.instance.inventory.Add(itms.item);
            }
            itms.item = lt;
            inventoryTable.Redraw();
            Player.instance.inventory.Remove(lt);
        }
        else
        {
            Debug.Log("Not a valid slot");
        }
    }
Пример #2
0
    private static void DiscardSelected()
    {
        Loot lt = myInventoryTable.RetrieveHighlight <Loot>();

        if (lt == null)
        {
            return;
        }
        Player.instance.coins += (int)lt.value;
        Player.instance.inventory.Remove(lt);
    }
Пример #3
0
    private static void BuySelected()
    {
        Loot lt = shopInventoryTable.RetrieveHighlight <Loot>();

        if (lt == null)
        {
            return;
        }
        if (Player.instance.coins < (int)lt.value)
        {
            return;
        }
        Player.instance.coins -= (int)lt.value;
        Player.instance.inventory.Add(lt);
    }