public void UseSFX(Script_Usable usable)
    {
        switch (usable)
        {
        case Script_UsableKey key:
            Debug.Log("YOU JUST USED A KEY... PLAY KEY SFX");
            GetComponent <AudioSource>().PlayOneShot(
                Script_SFXManager.SFX.useKey, Script_SFXManager.SFX.useKeyVol
                );
            break;

        default:
            Debug.LogWarning("Not a valid usable type used somehow, no SFX");
            break;
        }
    }
    public bool Use(Script_Usable usable)
    {
        bool isUsed = false;

        switch (usable)
        {
        case Script_UsableKey key:
            Debug.Log($"Usable case matched (type:key): {key}");
            isUsed = Script_Game.Game.GetPlayer().UseUsableKey(key);

            break;

        default:     // Cancel falls in here
            Debug.LogWarning("You haven't implemented this type of Usable");
            break;
        }

        return(isUsed);
    }
Ejemplo n.º 3
0
    void Use(Script_Usable usable, int itemSlotId)
    {
        HideItemChoices();
        EnterInventory();

        if (usablesHandler.Use(usable))
        {
            usablesHandler.UseSFX(usable);

            // Usables will only be stored in Items and not Stickers Inventory.
            items.RemoveItemInSlot(itemSlotId);

            /// Closing inventory will be handled by the UsableTarget
        }
        else
        {
            ErrorUnableSFX();
            return;
        }
    }