コード例 #1
0
    public bool UnstickSticker(
        Script_Sticker sticker,
        Script_Equipment equipment,
        Script_Inventory inventory,
        int stickerSlotId,
        bool isBackground = false
        )
    {
        // try to unequip, checking if inventory is full
        if (equipment.RemoveStickerInSlot(stickerSlotId))
        {
            /// On successful unequip, remove sticker from Equipment
            /// and also update Sticker Holster (done in Equipment)
            inventory.AddItem(sticker);

            if (!isBackground)
            {
                StickerOffSFX();
            }

            return(true);
        }
        else
        {
            Debug.LogWarning("Failed to unstick sticker; no space in inventory or not found");
            // TODO: show messaging or SFX
            GetComponent <Script_InventoryManager>().ErrorDullSFX();

            return(false);
        }
    }
コード例 #2
0
    // Use this for initialization
    void Awake()
    {
        if (_instance != null)
        {
            Debug.LogError("Creating multiple GameManagers!");
        }
        _instance = this;

        Inventory         = new Script_Inventory();
        CharacterManager  = new Script_CharacterManager();
        UIManager         = new Script_UIManager();
        CombatTextManager = new Script_CombatTextManager();

        Inventory.AddItem(new Script_HealthPotion(), 15);
        //Give player sword to start with
        var sword = new Script_Sword();

        Inventory.AddItem(sword);
        CharacterManager.GetCharacters()[0].EquipItem(sword);
    }