Exemple #1
0
    public override void Process()
    {
        if (HVRController.m_RightEventCamera == null)
        {
            return;
        }
        m_UiCamera = HVRController.m_RightEventCamera.GetComponent <Camera>();
        PointerEventData eventData = GetResultByGaze();

        if (eventData == null)
        {
            return;
        }
        if (eventData.enterEventCamera != null)
        {
            m_LinePointer = eventData.enterEventCamera.GetComponent <HVRLinePointer>();
        }

        UpdateCurrentObject();

        Camera camera = this.m_PointerEventData.enterEventCamera;

        m_LastGazeObj = m_NowGazeObj;
        m_NowGazeObj  = eventData.pointerCurrentRaycast.gameObject;

        UpdateAnchorPos(m_LastGazeObj);

        if (m_NowGazeObj == null && m_NowGazeObj != m_LastGazeObj)
        {
            eventSystem.SetSelectedGameObject(null);
        }
        if (Application.platform == RuntimePlatform.Android)
        {
            if (IsRightControllerButtonDown() || IsLeftControllerButtonDown())
            {
                this.HandleTrigger();
            }
            else if (IsRightControllerButtonUp() || IsLeftControllerButtonUp())
            {
                this.HandlePendingClick();
            }
        }
        else if (Application.platform == RuntimePlatform.WindowsEditor)
        {
            if (Input.GetMouseButtonDown(0))
            {
                this.HandleTrigger();
            }
            else if (Input.GetMouseButtonUp(0))
            {
                this.HandlePendingClick();
            }
        }

        ProcessDrag(eventData);
        ProcessHover(m_LastGazeObj, eventData);
        ProcessMove(m_PointerEventData);
    }
Exemple #2
0
 private void Awake()
 {
     m_Distance = m_MaxLineDistance;
     Instance   = this;
     if (this.m_Line != null)
     {
         this.m_LineRenderer = this.m_Line.GetComponent <LineRenderer>();
     }
     m_MeshRenderer            = this.m_Anchor.GetComponent <MeshRenderer>();
     m_ResourcesCursorMaterial = Resources.Load <Material>("Materials/controller_cursor");
     m_ResourcesSpotMaterial   = Resources.Load <Material>("Materials/controller_spot");
 }