Example #1
0
        private void Awake( )
        {
            if (null == parentGazeInteractive)
            {
                parentGazeInteractive = transform.parent.GetComponent <IGazeInteract>( );
            }

            return;
        }
Example #2
0
        // Update is called once per frame
        void Update( )
        {
            RaycastHit raycastHit;
            Vector3    cursorPos;

            cursorPos = gazeObject.transform.position + (gazeObject.transform.forward * defaultCursorDistance);
            if (true == Physics.Raycast(gazeObject.transform.position, gazeObject.transform.forward, out raycastHit))
            {
                IGazeInteract gazeInteract;

                gazeInteract = raycastHit.collider.GetComponent <IGazeInteract>( );
                if (null != currentSelectObject && gazeInteract != currentSelectObject)
                {
                    currentSelectObject.OnDeselect( );
                    currentSelectObject = null;
                }
                if (null != gazeInteract && gazeInteract != currentSelectObject)
                {
                    currentSelectObject = gazeInteract;
                    currentSelectObject.OnSelect( );
                }
                cursorPos = raycastHit.point;
            }
            else if (null != currentSelectObject)
            {
                currentSelectObject.OnDeselect( );
                currentSelectObject = null;
            }

            if (null != cursorObject)
            {
                cursorObject.transform.position = cursorPos;
            }

            return;
        }