コード例 #1
0
        public void RemoveTouch(Touch touch)
        {
            PersistentTouch knownTouch = GetPersistentTouch(touch.fingerId);

            if (knownTouch != null)
            {
                if (touch.phase == TouchPhase.Ended)
                {
                    if (knownTouch.lifetime < kContactEpsilon)
                    {
                        OnHoldCanceledEvent(touch.fingerId);
                    }
                    else if (knownTouch.lifetime < MaxTapContactTime)
                    {
                        OnHoldCanceledEvent(touch.fingerId);
                        OnTappedEvent(touch.fingerId, touch.tapCount);
                    }
                    else
                    {
                        OnHoldCompletedEvent(touch.fingerId);
                    }
                }
                else
                {
                    OnHoldCanceledEvent(touch.fingerId);
                }
                ActiveTouches.Remove(knownTouch);
            }
        }
コード例 #2
0
        public override bool TryGetPointingRay(uint sourceId, out Ray pointingRay)
        {
            PersistentTouch knownTouch = GetPersistentTouch((int)sourceId);

            if (knownTouch != null)
            {
                pointingRay = knownTouch.screenpointRay;
                return(true);
            }
            pointingRay = default(Ray);
            return(false);
        }
コード例 #3
0
        private Touch?GetTouch(int id)
        {
            PersistentTouch knownTouch = GetPersistentTouch(id);

            if (knownTouch != null)
            {
                return(knownTouch.touchData);
            }
            else
            {
                return(null);
            }
        }
コード例 #4
0
        public bool UpdateTouch(Touch touch, Ray ray)
        {
            PersistentTouch knownTouch = GetPersistentTouch(touch.fingerId);

            if (knownTouch != null)
            {
                knownTouch.lifetime += Time.deltaTime;

                return(true);
            }
            else
            {
                ActiveTouches.Add(new PersistentTouch(touch, ray));
                OnHoldStartedEvent(touch.fingerId);
                return(false);
            }
        }