示例#1
0
    public void GetTimeElapsed(GameObject focusedObject)
    {
        GameObject currentFocusedObj = TobiiAPI.GetFocusedObject();

        if (focusedObject != null)
        {
            Stopwatch stopwatch = new Stopwatch();
            stopwatch.Start();

            // while (currentFocusedObj == focusedObject)
            //{
            long elapsedTime = stopwatch.ElapsedTicks;
            for (int i = 0; i < 1000; i++)
            {
                print("i is" + i);
                print("Elapsed time is " + elapsedTime);
            }
            currentFocusedObj = TobiiAPI.GetFocusedObject();
            //LoadLevel("Gallery");
            //}
            stopwatch.Stop();


            print("The user is focused on the " + focusedObject);
        }
    }
示例#2
0
    private void UpdateObjectFocusedForSelection()
    {
        GameObject newlyFocusedObject = null;

        if (IsPlayerLookingAtCrosshair())
        {
            newlyFocusedObject = GetObjectAtCrosshair();
        }

        if (newlyFocusedObject == null)
        {
            newlyFocusedObject = TobiiAPI.GetFocusedObject();
            if (newlyFocusedObject != null)
            {
                if (Vector3.Distance(newlyFocusedObject.transform.position, ExtendedView.CameraWithoutExtendedView.transform.position) > MaxInteractionDistance)
                {
                    newlyFocusedObject = null;
                }
            }
        }

        if (!IsInteractableGazeAware(newlyFocusedObject))
        {
            newlyFocusedObject = null;
        }

        UpdatePreviouslyFocusedObject(newlyFocusedObject, _focusedObject, _focusedLastSeen);

        _focusedObject = newlyFocusedObject;
        if (_focusedObject != null)
        {
            _focusedLastSeen = Time.time;
        }
    }
示例#3
0
    void Update()
    {
        GameObject focusedObject = TobiiAPI.GetFocusedObject();

        if (null != focusedObject)
        {
            print("The focused game object is: " + focusedObject.name + " (ID: " + focusedObject.GetInstanceID() + ")");
        }
    }
    // Update is called once per frame
    void Update()
    {
        GameObject focusedObject = TobiiAPI.GetFocusedObject();

        if (focusedObject == gameObject)
        {
            brushManager.GetComponent <PlaceObject>().drawObject = brushObject;
        }
    }
示例#5
0
    // Update is called once per frame
    void Update()
    {
        if (!TobiiAPI.GetUserPresence().IsUserPresent())
        {
            return;
        }


        GazePoint gazePoint = TobiiAPI.GetGazePoint();

        Vector2 drawPoint = smoothFilter(Camera.main.ScreenToWorldPoint(gazePoint.Screen));

        if (Vector3.Magnitude(drawPoint - localPositionAverage) < focusRadius)
        {
            if ((Time.time - timeStart > timeInterval) && !toggleDraw && (null == TobiiAPI.GetFocusedObject()))
            {
                Debug.Log(Vector3.Magnitude(drawPoint - localPositionAverage));
                Debug.Log("average: " + localPositionAverage);
                Debug.Log("draw point: " + drawPoint);
                currentObject = Instantiate(drawObject, new Vector3(localPositionAverage.x, localPositionAverage.y, -Time.time / 100000), Quaternion.identity);
                timeStart     = Time.time;
                toggleDraw    = true;
                spotPause     = localPositionAverage;
            }
        }
        else
        {
            timeStart = Time.time;
        }

        /*if(toggleDraw && (Vector3.Magnitude(localPositionAverage - spotPause) > focusRadius))
         * {
         *  toggleDraw = false;
         * }*/

        if (toggleDraw)
        {
            if (Vector3.Magnitude(localPositionAverage - spotPause) > focusRadius)
            {
                toggleDraw = false;
            }

            if (currentObject != null)
            {
                currentObject.transform.localScale *= 1.01f;
            }
        }
        else
        {
        }


        movingAverage(drawPoint);
    }
示例#6
0
    // Update is called once per frame
    void Update()
    {
        if (TobiiAPI.IsConnected && NUIManager.Instance.typeOfNUI == 2)
        {
            GameObject focusedObject = TobiiAPI.GetFocusedObject();
            if (null != focusedObject && focusedObject == focus)
            {
                print("The focused game object is: " + focus.name);
                if (focus.tag == "LeftSphere")
                {
                    if (!isCoroutinestarted)
                    {
                        LeanTween.scale(Image, Vector3.one, 3f).setEaseOutQuad();
                        coroutine = CountToSelect();
                        StartCoroutine(coroutine);
                    }
                }

                if (focus.tag == "RightSphere")
                {
                    if (!isCoroutinestarted)
                    {
                        LeanTween.scale(Image, Vector3.one, 3f).setEaseOutQuad();
                        coroutine = CountToSelect();
                        StartCoroutine(coroutine);
                    }
                }

                if (focus.tag == "TopSphere")
                {
                    if (!isCoroutinestarted)
                    {
                        LeanTween.scale(Image, Vector3.one, 3f).setEaseOutQuad();
                        coroutine = CountToSelect();
                        StartCoroutine(coroutine);
                    }
                }
            }
            else
            {
                if (coroutine != null)
                {
                    StopCoroutine(coroutine);
                }
                isCoroutinestarted = false;
                LeanTween.cancel(Image);
                LeanTween.scale(Image, Vector3.zero, 0.5f).setEaseOutExpo();
            }
        }
    }
示例#7
0
        public override IEnumerator Log()
        {
            while (true)
            {
                yield return(new WaitForSeconds(0F));

                var tempObject = TobiiAPI.GetFocusedObject();
                if (tempObject != null)
                {
                    _sensorValue = TobiiAPI.GetFocusedObject().name.ToString();
                }
                else
                {
                    _sensorValue = GetSensorFailureValue();
                }
                //Debug.Log(_sensorValue);
            }
        }
示例#8
0
    public void Update()
    {
        GameObject focusedObject = TobiiAPI.GetFocusedObject();

        RaycastHit hit;
        Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);

        if (Input.GetMouseButtonDown(0))
        {
            print("MOUSE CLICK!");
            if (Physics.Raycast(ray, out hit, 100f) && hit.transform && hit.transform.gameObject.name == "sack_010")
            {
                //&& hit.transform.gameObject.name == "sack_010"
                print(hit.transform);
                print("YOU HIT A THE POUCH");
                LoadLevel("Creation");
            }
        }

        // EyeSelectLevel(focusedObject);
        // GetTimeElapsed(focusedObject);
    }
示例#9
0
    // Update is called once per frame
    void Update()
    {
        //if (TobiiAPI.GetFocusedObject() != null) {
        //  print(TobiiAPI.GetFocusedObject().name);
        //}
        focusedObject = TobiiAPI.GetFocusedObject();
        pos           = TobiiAPI.GetGazePoint();

        if (null != focusedObject)
        {
            using (System.IO.StreamWriter file =
                       new System.IO.StreamWriter(@"C:\Users\Djidjelly Siclait\Desktop\data.txt", true))
            {
                file.WriteLine("" + focusedObject.GetInstanceID() + "," + Time.time);
            }

            /*using (System.IO.StreamWriter file =
             *                  new System.IO.StreamWriter(@"C:\Users\mc\Desktop\WriteLines2.txt", true))
             *          {
             *                  file.WriteLine("The focused game object is: " + focusedObject.name + " (ID: " + focusedObject.GetInstanceID() + ")");
             *                  file.WriteLine(""+focusedObject.GetInstanceID());
             *          }*/
            print("The focused game object is: " + focusedObject.name + " (ID: " + focusedObject.GetInstanceID() + ")");
        }
        else
        {
            using (System.IO.StreamWriter file =
                       new System.IO.StreamWriter(@"C:\Users\mc\Desktop\IdTime.txt", true))
            {
                file.WriteLine("N/A , " + Time.time);
            }
        }
        using (System.IO.StreamWriter file =
                   new System.IO.StreamWriter(@"C:\Users\mc\Desktop\posTime.txt", true))
        {
            file.WriteLine(pos.Screen.x + "," + pos.Screen.x + "," + Time.time);
            //file.WriteLine("" + focusedObject.GetInstanceID());
        }
    }
示例#10
0
    // Update is called once per frame
    void Update()
    {
        focusedObject = TobiiAPI.GetFocusedObject();
        pos           = TobiiAPI.GetGazePoint();

        if (null != focusedObject)
        {
            if (9 < pos.Screen.x && 10 < (755 - pos.Screen.y))
            {
                primaryBuffer += (pos.Screen.x + 10) + "," + (755 - pos.Screen.y) + ":";
            }

            secondaryBuffer += focusedObject.name.Split(' ')[0] + "," + (currentpage + 1).ToString() + "," + Time.time + ":";

            if (Time.time % 15 == 0)
            {
                String URL1 = GetRelativePath() + "Shared Assets/output/reading" + (currentpage + 1).ToString() + ".txt";
                using (System.IO.StreamWriter file =
                           new System.IO.StreamWriter(URL1, true))
                {
                    file.WriteLine(primaryBuffer);
                    primaryBuffer = "";
                }

                String URL2 = GetRelativePath() + "Shared Assets/output/keywords.txt";
                using (System.IO.StreamWriter file =
                           new System.IO.StreamWriter(URL2, true))
                {
                    file.WriteLine(secondaryBuffer);
                    secondaryBuffer = "";
                }

                print("Transfering to data file.");
            }

            print("The focused game object is: " + focusedObject.name + " (ID: " + focusedObject.GetInstanceID() + ")");
        }
    }
示例#11
0
 // Update is called once per frame
 void Update()
 {
     focusedObj = TobiiAPI.GetFocusedObject();
     print("Your focused Object is: " + focusedObj);
 }