예제 #1
0
파일: AlphaTest.cs 프로젝트: HARd/Convicted
    public GameObject GetNextObjectTestAlpha(PointerEventData eventData)
    {
        List <RaycastResult> raycastResults = new List <RaycastResult>();

        EventSystem.current.RaycastAll(eventData, raycastResults);
        RaycastResult rr = raycastResults.Find((RaycastResult x) =>
        {
            if (x.gameObject == gameObject)
            {
                return(false);
            }

            AlphaTest alphaTest = x.gameObject.GetComponent <AlphaTest>();
            if (alphaTest == null)
            {
                return(true);
            }
            else
            {
                return(alphaTest.IsAlphaPoint(eventData));
            }
        });

        print(rr.gameObject.name);
        return(rr.gameObject);
    }
예제 #2
0
    public void OnEndDrag(PointerEventData eventData)
    {
        if (eventData.pointerEnter != null)
        {
            AlphaTest alphaTest = eventData.pointerEnter.GetComponent <AlphaTest>();

            if (alphaTest != null && !alphaTest.IsAlphaPoint(eventData))
            {
                eventData.pointerEnter = alphaTest.GetNextObjectTestAlpha(eventData);
            }
        }

        SendMessage("OnDragFinish", eventData, SendMessageOptions.DontRequireReceiver);
    }