Пример #1
0
    private void Update()
    {
        if (Input.GetKeyDown(interactKey))
        {
            if (target == null)
            {
                return;
            }

            FoodBox food = target.GetComponent <FoodBox>();
            if (food != null && itemHolder == null)
            {
                food.Interact(this);
            }

            TableBox table = target.GetComponent <TableBox>();
            if (table != null)
            {
                table.Interact(itemHolder, this);
            }

            ResultPost resultPost = target.GetComponent <ResultPost>();
            if (resultPost != null)
            {
                resultPost.Interact(itemHolder, this);
            }

            //TrashCan trashCan = target.GetComponent<TrashCan>();
            //if (trashCan != null)
            //{
            //    trashCan.Interact(crop, this);
            //}
        }
    }