protected void Update()
    {
        LastFixation = _dataProvider.Last;

        // Get the last fixation point.
        EyeXFixationPoint lastFixation = GetComponent <FixationDataComponent>().LastFixation;

        if (lastFixation.IsValid)
        {
            if (lastFixation.EventType == FixationDataEventType.Begin)
            {
                // A fixation started.
                // Convert the fixation data to screen space.
                Vector2 screenCoordinates = lastFixation.GazePoint.Screen;
                Vector3 worldCoordinates  = Camera.main.ScreenToWorldPoint(new Vector3(screenCoordinates.x, screenCoordinates.y, 0));

                Ray fixationRay = Camera.main.ScreenPointToRay(new Vector3(screenCoordinates.x, screenCoordinates.y, 0));
                Debug.DrawRay(fixationRay.origin, fixationRay.direction * 30, Color.magenta);

                if (Physics.Raycast(fixationRay.origin, fixationRay.direction, out fixationRaycastHit, 30))
                {
                    //Debug.Log ("I fixed: " + fixationRaycastHit.collider.gameObject.name);
                    string fixedObject = fixationRaycastHit.collider.gameObject.name;

                    colorCollider.transform.position = fixationRaycastHit.transform.position;

                    //fixationRaycastHit.collider.gameObject.transform.position = new Vector3(0, 0, 0);

                    //Debug.Log ("fixedObject: " + fixedObject);
                    AudioFilesLevelFloppi afFloppi = GameObject.Find("AudioFilesLevelFloppi").GetComponent <AudioFilesLevelFloppi>();

                    if (fixedObject.Contains("Button_red"))
                    {
                        AudioManager.instance.playAudioClipIfFree(afFloppi.getRedButtonClip());
                    }
                    else if (fixedObject.Contains("Button_green"))
                    {
                        AudioManager.instance.playAudioClipIfFree(afFloppi.getGreenButtonClip());
                    }
                    else if (fixedObject.Contains("Button_blue"))
                    {
                        AudioManager.instance.playAudioClipIfFree(afFloppi.getBlueButtonClip());
                    }
                }
            }
            else if (lastFixation.EventType == FixationDataEventType.Data)
            {
                // Fixation data is being retrieved.
            }
            else if (lastFixation.EventType == FixationDataEventType.End)
            {
                // The fixation ended.
            }



            /*Ray fixationRay = Camera.main.ScreenPointToRay(new Vector3(screenCoordinates.x, screenCoordinates.y, 0.0f));
             * Debug.DrawRay (fixationRay.origin, fixationRay.direction * distanceToSee, Color.magenta);
             *
             * if (Physics.Raycast (gazeRay.origin, gazeRay.direction, out gazeRaycastHit, distanceToSee)) {
             *      Debug.Log ("I gazed: " + gazeRaycastHit.collider.gameObject.name);
             *      gazeRaycastHit.collider.gameObject.GetComponent<Renderer>().material.color = Color.green;
             *
             *      // set timer of block to 1 (when timer reaches 0 it will get standard gray color)
             *      BlockScript blockScript = gazeRaycastHit.collider.gameObject.GetComponent<BlockScript>();
             *      blockScript.lostGazeTimer = 0.35f;
             * }*/
        }
    }
 protected void Update()
 {
     LastFixation = _dataProvider.Last;
 }
    // Update is called once per frame
    void Update()
    {
        //if nothing has been selected yet
        if (selected == null)
        {
            if (Input.GetKeyDown(KeyCode.J) || Input.GetMouseButtonDown(1))
            {
                //Check if SelectableObjects have the user's Gaze
                for (int i = 0; i < selectableObjects.Length; i++)
                {
                    if (selectableObjects[i].GetComponent<SelectableObject>().GazeAwareComp.HasGaze)
                    {
                        selected = selectableObjects[i];
                        selected.GetComponent<SelectableObject>().selected = true;
                        confirmSelectionSound.Play();
                        break;
                    }
                }
                //If the GazeAwareComponent returns null, use fixation and ray cast to see if an object is selectable
                if (selected == null)
                {
                    RaycastHit hit;
                    Ray ray = new Ray();
                    if (GameObject.FindGameObjectWithTag("MainCamera").GetComponent<ThirdPersonCamera>().EyeControlState == ThirdPersonCamera.EyeControlStates.No_Gaze)
                    {
                        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
                    }
                    else
                    {
                        //FixationComponent.enabled = false;
                        fixation = FixationComponent.LastFixation;

                        Debug.Log(fixation.GazePoint.Screen);

                        if (fixation.IsValid && fixation.GazePoint.IsWithinScreenBounds)
                        {
                            //get the point you are fixated on
                            Vector3 gazePointScreen = fixation.GazePoint.Screen;

                            Debug.Log(gazePointScreen);
                            //draw a ray from this point
                            ray = Camera.main.ScreenPointToRay(gazePointScreen);

                        }

                    }

                    //if the ray hits an object
                    if (Physics.Raycast(ray, out hit, 10000))
                    {
                        //select the given object if it can be selected
                        if (hit.collider.gameObject.tag == "MoveableObject")
                        {
                            //set the selected object to selected
                            hit.collider.GetComponent<SelectableObject>().selected = true;
                            confirmSelectionSound.Play();
                            //save that game object so that you can move it
                            selected = hit.collider.gameObject;

                            distance = transform.position.z - selected.transform.position.z;
                        }
                    }
                }

            }
        }
        // if there is an object selected
        else if (selected)
        {
            if (GameObject.FindGameObjectWithTag("MainCamera").GetComponent<ThirdPersonCamera>().EyeControlState == ThirdPersonCamera.EyeControlStates.No_Gaze)
            {
                selected.GetComponent<SelectableObject>().target = Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, 100));
            }
            else
            {
                Debug.Log(gazeData.LastGazePoint);
                if (gazeData.LastGazePoint.IsValid && gazeData.LastGazePoint.IsWithinScreenBounds)
                {
                    //keep object at the gaze point x units away
                    selected.GetComponent<SelectableObject>().target = Camera.main.ScreenToWorldPoint(new Vector3(gazeData.LastGazePoint.Screen.x, gazeData.LastGazePoint.Screen.y, 100));
                }
                //hit the j key while an object is selected to stop selecting the object

            }
            if (Input.GetKeyDown(KeyCode.N) || Input.GetMouseButtonDown(2))
            {
                selected.GetComponent<SelectableObject>().selected = false;
                selected = null;

            }

        }
    }
 protected void Update()
 {
     LastFixation = _dataProvider.Last;
 }