Пример #1
0
    void UseItem()
    {
        switch (itemType)
        {
        case ITEM_TYPE.SKILL:
            switch (effectType)
            {
            case EFFECT_TYPE.E_EXPLOSION:
                Inventory inv = MyNetwork.instance.localPlayer.GetComponent <Inventory>();
                inv.OnHandRange++;
                inv.UpdateUI();
                break;

            case EFFECT_TYPE.E_HEALTH:
                CharacterStats stats = MyNetwork.instance.localPlayer.GetComponent <CharacterStats>();
                stats.increaseHealth(stats.hpSys.MAX_HEALTH);
                break;
            }
            // give a randomized skill? or already randomized at the start and just give a skill
            break;

        case ITEM_TYPE.QUESTION:
            // enables quiz menu
            EnableQuiz();
            break;

        case ITEM_TYPE.KEY:
            player.ReceiveKey();
            break;
        }

        // Remove item
        GameObject.Destroy(gameObject);
    }