Ejemplo n.º 1
0
        public static void SetSave(PuzzleObject obj)
        {
            SaveModel sm = new SaveModel();

            sm.obj_id  = obj._component.id;
            sm.enabled = obj._component.rt.gameObject.GetComponent <PuzzleDragAndDrop>().enabled == true ? 1 : 0;
            sm.posx    = obj._component.rt.anchoredPosition3D.x + "";
            sm.posy    = obj._component.rt.anchoredPosition3D.y + "";
            sm.parent  = obj.GetParent();

            sm.Save();
        }
Ejemplo n.º 2
0
    public void OnBeginDrag(PointerEventData eventData)
    {
        if (enabled)
        {
            GameObject.Find("Click up").gameObject.GetComponent <AudioSource>().Play();

            dragged = gameObject;
            rt      = dragged.GetComponent <RectTransform>();
            offset  = rt.sizeDelta.x / 2;

            obj = new PuzzleObject(dragged.GetComponent <PuzzleComponent>().id);

            int pid = obj.GetParent();

            if (pid > 0)
            {
                obj = new PuzzleObject(pid);
                rt  = obj._component.rt;
            }

            enabled = GameObject.Find("puzzle" + obj.GetID()).GetComponent <PuzzleDragAndDrop>().enabled;
        }
    }