Ejemplo n.º 1
0
        protected virtual void OnEndDragPoint(BaseEventData evData)
        {
            PointerEventData pData = evData as PointerEventData;

            if (pData == null)
            {
                return;
            }

            //if smtg below, drawline stay true, otherwise drawline = false
            if (EventSystem.current.IsPointerOverGameObject())
            {
                List <RaycastResult> results = new List <RaycastResult>();
                EventSystem.current.RaycastAll(pData, results);
                bool hit = false;
                for (int i = 0; i < results.Count; i++)
                {
                    NodeVisual r = results[i].gameObject.GetComponent <NodeVisual>();
                    if (r != null && r != this)
                    {
                        mNode.StopListening();
                        listenTo       = r;
                        mNode.listenTo = r.node;//l'ordre est important ici
                        mNode.ListenTo(r.node);
                        hit = true;
                        break;
                    }
                }
                if (!hit)
                {
                    drawLine = false;
                    listenTo = null;
                    mNode.StopListening();//lordre est important ici
                    mNode.listenTo = null;
                }
            }
        }