예제 #1
0
 public void TouchUp(VRInput source)
 {
     if (OnTouchUp != null)
     {
         OnTouchUp(source);
     }
 }
예제 #2
0
 public void TouchDown(VRInput source)
 {
     if (OnTouchDown != null)
     {
         OnTouchDown(source);
     }
 }
예제 #3
0
 public void TriggerDown(VRInput source)
 {
     if (OnTriggerDown != null)
     {
         OnTriggerDown(source);
     }
 }
예제 #4
0
 public void Click(VRInput source)
 {
     if (OnClick != null)
     {
         OnClick(source);
     }
 }
예제 #5
0
 public void Down(VRInput source)
 {
     if (OnDown != null)
     {
         OnDown(source);
     }
 }
예제 #6
0
 public void Up(VRInput source)
 {
     if (OnUp != null)
     {
         OnUp(source);
     }
 }
예제 #7
0
 public void DoubleClick(VRInput source)
 {
     if (OnDoubleClick != null)
     {
         OnDoubleClick(source);
     }
 }
예제 #8
0
 public void TriggerOver(VRInput source)
 {
     m_nTriggerCount++;
     if (OnTriggerOver != null)
     {
         OnTriggerOver(source);
     }
 }
예제 #9
0
 public void TriggerOut(VRInput source)
 {
     m_nTriggerCount--;
     if (OnTriggerOut != null)
     {
         OnTriggerOut(source);
     }
 }
예제 #10
0
 public void PointerOut(VRInput source)
 {
     m_nPointerCount--;
     if (OnPointerOut != null)
     {
         OnPointerOut(source);
     }
 }
예제 #11
0
        public void TriggerUp(VRInput source)
        {
            if (OnTriggerUp != null)
            {
                OnTriggerUp(source);
            }

            TriggerOut(source);
        }
예제 #12
0
        public void GazeOut(VRInput source)
        {
            m_nGazeCount--;

            if (OnGazeOut != null)
            {
                OnGazeOut(source);
            }
        }
예제 #13
0
        public void PointerOver(VRInput source)
        {
            m_nPointerCount++;

            if (OnPointerOver != null)
            {
                OnPointerOver(source);
            }
        }
예제 #14
0
        // The below functions are called by the VREyeRaycaster when the appropriate input is detected.
        // They in turn call the appropriate events should they have subscribers.
        public void GazeOver(VRInput source)
        {
            m_nGazeCount++;

            if (OnGazeOver != null)
            {
                OnGazeOver(source);
            }
        }
예제 #15
0
        public void SetInput(VRInput input)
        {
            // Unlikely, but if we weren't null and are enabled
            // then unsubscribe and resubscribe later
            if (isActiveAndEnabled)
            {
                clearCallbacks();
            }

            m_VrInput = input;
            if (m_VrInput != null)
            {
                transform.SetParent(m_VrInput.transform);
            }

            if (isActiveAndEnabled)
            {
                setCallbacks();
            }
        }
예제 #16
0
        // On trigger up, if we have a follow object and our input is its parent
        // (which is guaranteed, I think), then destroy the tracked object and unsubscribe
        private void Detach()
        {
            // Destroy tracked object
            if (m_InputFollow)
            {
                m_ActiveInput._onRelease(this);

                if (OnRelease != null)
                {
                    OnRelease(this, m_ActiveInput);
                }

                Destroy(m_InputFollow.gameObject);
                m_InputFollow = null;
            }

            // Unsubscribe if we've assigned this (only assigned when we subscribe)
            if (m_ActiveInput)
            {
                m_ActiveInput.OnTriggerUp -= Detach;
                m_ActiveInput              = null;
            }
        }
예제 #17
0
        // On grab we create an object to follow at our position
        // but as a child of the input - when the input moves,
        // our tracked object moves with it and we respond
        private void Attach(VRInput input)
        {
            // Detach, just in case
            Detach();

            // Create object to follow at our pull distance from the input
            m_InputFollow = new GameObject("GrabFollow").transform;

            Vector3 v3PullDist = PullDistance * input.transform.forward.normalized;

            m_InputFollow.transform.position = input.transform.position + v3PullDist;
            m_InputFollow.transform.parent   = input.transform;

            // Subscribe to this input's OnTriggerUp and cache
            // it so that we can unsubscribe from OnTriggerUp
            m_ActiveInput      = input;
            input.OnTriggerUp += Detach;

            input._onGrab(this);
            if (OnGrab != null)
            {
                OnGrab(this, input);
            }
        }