Esempio n. 1
0
        /* global touch event (everybody get this event) */
        private void eventOnTouch(InputTouchFinger finger)
        {
            if (!reactToTouch())
            {
                return;
            }

            if (dontReactToCapturedFinger)
            {
                if (!finger.isCapturedBy(this) && finger.isCaptured())
                {
                    //Debug.Log(name + " can't react to finger " + finger.fingerId + " because is captured by someone else : " + finger.captured, gameObject);
                    return;
                }
            }

            //Debug.Log(finger.fingerId + " on touch "+name);

            onTouch(finger);

            RaycastHit2D?hit = getLocalMatchingColliderWithFinger(finger);

            if (hit != null)
            {
                _touching = true;

                //Debug.Log("{InputObject} input touch over " + hit.Value.transform.name);
                eventTouchOver(finger, hit.Value);
            }
        }
Esempio n. 2
0
        private void eventOnRelease(InputTouchFinger finger)
        {
            if (!reactToTouch())
            {
                return;
            }

            //Debug.Log(name+" release finger "+finger.fingerId);

            if (finger.isCapturedBy(this))
            {
                //Debug.Log(name + " <b>released</b> finger " + finger.fingerId);
                finger.captured = null;
            }

            if (!_interactive)
            {
                return;
            }

            if (finger.isCaptured() && dontReactToCapturedFinger)
            {
                return;
            }

            //on a besoin que touching soit MAJ avant d'apl ça pour le cas ou on desactive l'interactivité de l'extérieur
            bool wasTouching = _touching;

            _touching = false;

            onRelease(finger);

            if (wasTouching)
            {
                //chopper le hit correspondant a mes colliders
                RaycastHit2D?hit = getLocalMatchingColliderWithFinger(finger);

                if (hit != null)
                {
                    //Debug.Log("{InputObject} input released over " + hit.Value.transform.name);
                    onReleaseOver(finger, hit.Value);
                }
            }

            //if (cbRelease != null) cbRelease(finger);
        }