Exemple #1
0
    private void OnTriggerEnter(Collider other) //checks if the player has collided with a valid item and places it in their inventory if there is a slot
    {
        string Item = other.gameObject.tag;

        if (numberOfItems < 4)
        {
            switch (Item)
            {
            case "Durian":
            case "Cookie":
            case "WatermelonSlice":
            case "Banana":
            case "Fries":
            case "Egg":
            case "Kimchi":
            case "Onion":
            case "BakedBeans":
            case "EnergyDrink":
            case "Plastic Bag":
                InventoryManager(Item);
                Destroy(other.gameObject);
                break;

            default:
                break;
            }
        }
        if (Item == "Teddy Bear")
        {
            SceneControl.BearPickup();
            Destroy(other.gameObject);
        }
    }