Example #1
0
    //public void OnClickUseItem()
    //{
    //    ItemDragDrop i = Instantiate(foodPrefab, GameObject.Find("CanvasDragDrop").transform,false);
    //    i.Config(()=> {
    //        Player.instance.OnItemFoodUp();
    //        GameController.instance.UseFood(comida);
    //        PopupFreezer.instance.Show();
    //    }, comida.icon);
    //    PopupFreezer.instance.Hidden();

    //}


    public void OnDrag(PointerEventData eventData)
    {
        if (inDrag && childInstantiate != null)
        {
            childInstantiate.OnDrag(eventData);
        }
        else
        {
            inDrag = true;

            ItemDragDrop i = Instantiate(foodPrefab, GameObject.Find("CanvasDragDrop").transform, false);

            i.Config(() =>
            {
                Player.instance.OnItemFoodUp(comida);
                GameController.instance.UseFood(comida);
                PopupFreezer.instance.Show();
            }, ItemDragDrop.TypeObject.food, comida.icon);

            i.transform.position = Input.mousePosition;

            childInstantiate = i;

            PopupFreezer.instance.Hidden();
        }
    }
Example #2
0
    public void OnDrag(PointerEventData eventData)
    {
        if (inDrag && childInstantiate != null)
        {
            childInstantiate.OnDrag(eventData);
        }
        else
        {
            inDrag = true;

            ItemDragDrop i = Instantiate(medicamentoPrefab, GameObject.Find("CanvasDragDrop").transform, false);

            i.Config(() =>
            {
                Player.instance.OnItemMedicamentoUp(medicamento);
                PopupMedicamentos.instance.Show();
            }, ItemDragDrop.TypeObject.medicamento, IconeMedicamento[medicamento.Icone]);

            i.transform.position = Input.mousePosition;

            childInstantiate = i;

            PopupMedicamentos.instance.Hidden();
        }
    }