Example #1
0
    public override void Use(int invIndex)
    {
        Debug.Log("InvSlot use item: " + name);

        if (foodType.Equals(FoodType.food))
        {
            FindObjectOfType <AudioManager>().Play("eating");
        }
        else
        {
            FindObjectOfType <AudioManager>().Play("drinking");
        }

        if (addHunger > 0)
        {
            PlayerManager.Instance.addHunger(addHunger);
        }
        else
        {
            PlayerManager.Instance.reduceHunger(addHunger);
        }

        if (addThirst > 0)
        {
            PlayerManager.Instance.addThirst(addThirst);
        }
        else
        {
            PlayerManager.Instance.reduceThirst(addThirst);
        }

        if (addEnergy > 0)
        {
            PlayerManager.Instance.addEnergy(addEnergy);
        }
        else
        {
            PlayerManager.Instance.reduceEnergy(addEnergy);
        }

        Inventory.Instance.removeFromInv(invIndex);
    }