Example #1
0
    // shows the invisible walls when the user closed his eyes
    private void showInvisibleWallsOnEyeClose()
    {
        // check whether left and right eye are closed
        EyeXEyePosition lastEyePosition = eyePositionDataProvider.Last;

        //Debug.Log ("lastEyePosition: " + lastEyePosition);

        if (!lastEyePosition.RightEye.IsValid && !lastEyePosition.LeftEye.IsValid)
        {
            timeEyesAreClosed += Time.deltaTime;
        }
        else
        {
            timeEyesAreClosed = 0.0f;
        }

        if (timeEyesAreClosed > 1.0f)
        {
            // show the walls
            //GameObject.Find ("Level_1_Obstacle_Wall_01").GetComponent<MeshRenderer>().enabled = true;
            GameObject.Find("Level_1_Obstacle_Wall_02").GetComponent <MeshRenderer>().enabled = true;
            GameObject.Find("Level_1_Obstacle_Wall_03").GetComponent <MeshRenderer>().enabled = true;
            //GameObject.Find ("Level_1_Obstacle_Wall_04").GetComponent<MeshRenderer>().enabled = true;

            // disable the wall collider
            GameObject.Find("WallCollider").GetComponent <BoxCollider>().enabled = false;

            // set walltriggerstarted to false so that no new audio clip will get queued saying that you should close your eyes
            this.wallTriggerStarted = false;

            wallsVisible = true;
        }
    }
        void GetEyesPosition()
        {
            if (PlayMakerEyexEyePositionDataProxy.Instance == null)
            {
                LogError("Missing 'PlayMaker Tobii Eyex' prefab instance in Scene!");
                Fsm.Event(errorEvent);
                return;
            }

            _pos = PlayMakerEyexEyePositionDataProxy.Instance.LastEyePosition;

            if (!isValid.IsNone)
            {
                isValid.Value = _pos!=null?_pos.IsValid:false;
            }

            if ( _pos!=null && _pos.IsValid)
            {
                if (!leftEyeIsValid.IsNone)
                {
                    leftEyeIsValid.Value = _pos.LeftEye.IsValid;
                }

                if (!leftEyePosition.IsNone && _pos.LeftEye.IsValid)
                {
                    leftEyePosition.Value = new Vector3(_pos.LeftEye.X,_pos.LeftEye.Y,_pos.LeftEye.Z);
                }

                if (!leftEyePositionNormalized.IsNone && _pos.LeftEye.IsValid)
                {
                    leftEyePositionNormalized.Value = new Vector3(1f-_pos.LeftEyeNormalized.X,1f-_pos.LeftEyeNormalized.Y,1f-_pos.LeftEyeNormalized.Z);
                }

                if (!rightEyeIsValid.IsNone)
                {
                    rightEyeIsValid.Value = _pos.RightEye.IsValid;
                }

                if (!rightEyePosition.IsNone && _pos.RightEye.IsValid)
                {
                    rightEyePosition.Value = new Vector3(_pos.RightEye.X,_pos.RightEye.Y,_pos.RightEye.Z);
                }

                if (!righEyePositionNormalized.IsNone && _pos.RightEye.IsValid)
                {
                    righEyePositionNormalized.Value = new Vector3(1f-_pos.RightEyeNormalized.X,1f-_pos.RightEyeNormalized.Y,1f-_pos.RightEyeNormalized.Z);
                }
            }else{
                if (!leftEyeIsValid.IsNone)
                {
                    leftEyeIsValid.Value = false;
                }

                if (!rightEyeIsValid.IsNone)
                {
                    rightEyeIsValid.Value = false;
                }
            }
        }
    protected void Update()
    {
        LastEyePosition = _dataProvider.Last;

        if (LastEyePosition.LeftEye.IsValid != LastLeftEyeValidState)
        {
            LastLeftEyeValidState = LastEyePosition.LeftEye.IsValid;

            PlayMakerFSM.BroadcastEvent(LastLeftEyeValidState?LeftEyeValidEventName:LeftEyeInValidEventName);
        }

        if (LastEyePosition.RightEye.IsValid != LastRightEyeValidState)
        {
            LastRightEyeValidState = LastEyePosition.RightEye.IsValid;

            PlayMakerFSM.BroadcastEvent(LastRightEyeValidState?RightEyeValidEventName:RightEyeInValidEventName);
        }
    }
Example #4
0
    protected void Update()
    {
        LastEyePosition = _dataProvider.Last;

        if (LastEyePosition.LeftEye.IsValid != LastLeftEyeValidState)
        {
            LastLeftEyeValidState = LastEyePosition.LeftEye.IsValid;

            PlayMakerFSM.BroadcastEvent(LastLeftEyeValidState?LeftEyeValidEventName:LeftEyeInValidEventName);
        }

        if (LastEyePosition.RightEye.IsValid != LastRightEyeValidState)
        {
            LastRightEyeValidState = LastEyePosition.RightEye.IsValid;

            PlayMakerFSM.BroadcastEvent(LastRightEyeValidState?RightEyeValidEventName:RightEyeInValidEventName);
        }
    }
    void Update()
    {
        EyeXEyePosition eyePosition = _eyePositionDataComponent.LastEyePosition;

        if (eyePosition != null)
        {
            if ((InputManager.tobiiOn && (eyePosition.LeftEye.IsValid ^ eyePosition.RightEye.IsValid)) ||
                (!InputManager.tobiiOn && (Input.GetKey(KeyCode.Mouse0) ^ Input.GetKey(KeyCode.Mouse1))))
            {
                _deactivatedRenderTime = 0f;
                _activatedRenderTime  += Time.deltaTime;
                if (_activatedRenderTime >= (thresholdMs / 1000f))
                {
                    ToggleGhostPirates(true);
                    if (eyePosition.RightEye.IsValid || Input.GetKey(KeyCode.Mouse0))   //Right-eye is open
                    {
                        _spotlight.cookie = rightEyeSpot;
                        ToggleGhostCrates(true);
                    }
                    if (eyePosition.LeftEye.IsValid || Input.GetKey(KeyCode.Mouse1))   //Left-eye is open
                    {
                        _spotlight.cookie = leftEyeSpot;
                        ToggleFakeCrates(true);
                    }
                }
            }
            else
            {
                _activatedRenderTime    = 0f;
                _deactivatedRenderTime += Time.deltaTime;
                if (_deactivatedRenderTime >= (thresholdMs / 1000f))
                {
                    _spotlight.cookie = originalEyeSpot;
                    ToggleGhostCrates(false);
                    ToggleGhostPirates(false);
                    ToggleFakeCrates(false);
                }
            }
        }
    }
 protected void Update()
 {
     LastEyePosition = _dataProvider.Last;
 }
 protected void Update()
 {
     LastEyePosition = _dataProvider.Last;
 }
Example #8
0
    protected void Update()
    {
        LastEyePosition = _dataProvider.Last;

        // Get the last eye position.
        EyeXEyePosition lastEyePosition = GetComponent <EyePositionDataComponent>().LastEyePosition;

        if (lastEyePosition.IsValid)
        {
            // Get the position of the left eye.
            Vector3 leftEyePosition = new Vector3(lastEyePosition.LeftEye.X,
                                                  lastEyePosition.LeftEye.Y,
                                                  lastEyePosition.LeftEye.Z);


            // The Eye Position of a closed eye will be (0, 0, 0)
            // Sometimes single eye positions can be (0, 0, 0) even though the eye was opened

            Vector3 rightEyePosition = new Vector3(lastEyePosition.RightEye.X,
                                                   lastEyePosition.RightEye.Y,
                                                   lastEyePosition.RightEye.Z);



            //Debug.Log ("leftEyePosition: " + leftEyePosition);
            //Debug.Log ("rightEyePosition: " + rightEyePosition);


            if (!lastEyePosition.LeftEye.IsValid && !lastEyePosition.RightEye.IsValid)
            {
                // Eyes closed
                this.eyesOpenedQueue.Enqueue(EyesOpened.None);
                eyesClosedCounter++;
                //Debug.Log ("!!! - !!! both eyes closed!!!!!!!!");
            }
            else if (lastEyePosition.LeftEye.IsValid && !lastEyePosition.RightEye.IsValid)
            {
                // only left eye is opened
                this.eyesOpenedQueue.Enqueue(EyesOpened.Left);
            }
            else if (!lastEyePosition.LeftEye.IsValid && lastEyePosition.RightEye.IsValid)
            {
                // only right eye is opened
                this.eyesOpenedQueue.Enqueue(EyesOpened.Right);
            }
            else
            {
                // both eyes opened
                this.eyesOpenedQueue.Enqueue(EyesOpened.Both);
                eyesClosedCounter = eyesClosedCounter / 3;
            }


            // calculate the amount of each eye-State in the queue!
            if (this.eyesOpenedQueue.Count > 30)
            {
                EyesOpened[] eyesOpenedArray = this.eyesOpenedQueue.ToArray();
                int          noneCount       = 0;
                int          leftCount       = 0;
                int          rightCount      = 0;
                int          bothCount       = 0;

                foreach (EyesOpened eyesOpened in eyesOpenedArray)
                {
                    switch (eyesOpened)
                    {
                    case EyesOpened.None: {
                        noneCount++;
                        break;
                    }

                    case EyesOpened.Left: {
                        leftCount++;
                        break;
                    }

                    case EyesOpened.Right: {
                        rightCount++;
                        break;
                    }

                    case EyesOpened.Both: {
                        bothCount++;
                        break;
                    }
                    }
                }


                /*Debug.Log ("leftEyePosition: " + leftEyePosition);
                 * Debug.Log ("rightEyePosition: " + rightEyePosition);
                 * Debug.Log ("leftEyeIsValid: " + lastEyePosition.LeftEye.IsValid);
                 * Debug.Log ("rightEyeIsValid: " + lastEyePosition.RightEye.IsValid);
                 * Debug.Log ("noneCount: " + noneCount);
                 * Debug.Log ("leftCount: " + leftCount);
                 * Debug.Log ("rightCount: " + rightCount);
                 * Debug.Log ("bothCont: " + bothCount);*/


                // check which left-eye / right-eye objects should be visible
                if (noneCount >= leftCount && noneCount >= rightCount && noneCount >= bothCount)
                {
                    // "none" was most often recognized
                    this.hideLeftEyeObjects();
                    this.hideRightEyeObjects();
                    //Debug.Log ("NONE");
                }
                else if (leftCount >= rightCount && leftCount >= bothCount)
                {
                    // "left" was most often recognized
                    this.showLeftEyeObjects();
                    this.hideRightEyeObjects();
                    //Debug.Log ("LEFT");
                }
                else if (rightCount >= bothCount)
                {
                    // "right" was most often recognized
                    this.hideLeftEyeObjects();
                    this.showRightEyeObjects();
                    //Debug.Log ("RIGHT");
                }
                else
                {
                    // "both" was most often recognized
                    this.hideLeftEyeObjects();
                    this.hideRightEyeObjects();
                    //Debug.Log ("BOTH");
                }

                // check if eyes were closed
                if (leftCount == 0 && rightCount == 0 && bothCount == 0)
                {
                    //Debug.Log ("EYES LONG CLOSED");

                    // both eyes were closed for a while, if you are in felldown mode respawn
                    FirstPersonController fps = GameObject.Find("Player").GetComponent <FirstPersonController>();

/*-----------					AudioFilesLevelFloppi afFloppi = GameObject.Find ("AudioFilesLevelFloppi").GetComponent<AudioFilesLevelFloppi>();
 *
 *                                      AudioSource audioSource = fps.gameObject.GetComponent<AudioSource>();
 *
 *                                      if (afFloppi.fellofZone != AudioFilesLevelFloppi.FellofZone.None) {
 *                                              // respawn player
 *                                              fps.Die ();
 *                                              afFloppi.fellofZone = AudioFilesLevelFloppi.FellofZone.None;
 *
 *                                              // after second try play sound after respawning
 *                                              if (afFloppi.bridgeFelldownCounter >= 2) {
 *                                                      AudioManager.instance.queueAudioClip(afFloppi.getBridgeBeforeClip());
 *                                              }
 *                                      } */
                }

                this.eyesOpenedQueue.Dequeue();
            }



            // check whether bridge should be broad or not
            // make bridge wider if both eyes are closed
            GameObject bridge = GameObject.Find("bridge");

            if (eyesClosedCounter > 24)
            {
                bridge.transform.localScale = new Vector3(1, 1, 6);
                GameObject.Find("BridgeCollider").GetComponent <BoxCollider>().enabled = false;
                //GetComponent<BridgeCollider>().enabled = false;
            }
            else
            {
                bridge.transform.localScale = new Vector3(1, 1, 1.0f);
                GameObject.Find("BridgeCollider").GetComponent <BoxCollider>().enabled = true;
                //GetComponent<BridgeCollider>().enabled = true;
            }
        }
        else
        {
            //Debug.Log ("leftEyePosition INVALID!");
        }
    }
Example #9
0
    // Update is called once per frame
    void Update()
    {
        lastEyePosition = dataProvider.Last;
        //EyeXEyePosition lastEyePosition = GetComponent<EyePositionDataComponent>().LastEyePosition;
        eyesClosedDuration -= Time.deltaTime;

        if (lastEyePosition.IsValid)
        {
            // Get the position of the left eye.
            Vector3 leftEyePosition = new Vector3(lastEyePosition.LeftEye.X,
                                                  lastEyePosition.LeftEye.Y,
                                                  lastEyePosition.LeftEye.Z);


            // The Eye Position of a closed eye will be (0, 0, 0)
            // Sometimes single eye positions can be (0, 0, 0) even though the eye was opened

            // Get the position of the right eye.
            Vector3 rightEyePosition = new Vector3(lastEyePosition.RightEye.X,
                                                   lastEyePosition.RightEye.Y,
                                                   lastEyePosition.RightEye.Z);


            if (!lastEyePosition.LeftEye.IsValid && !lastEyePosition.RightEye.IsValid)
            {
                // Eyes closed
                this.eyesOpenedQueue.Enqueue(EyesOpened.None);
                eyesClosedCounter++;
                eyesClosedDuration += 2 * Time.deltaTime;
            }
            else if (lastEyePosition.LeftEye.IsValid && !lastEyePosition.RightEye.IsValid)
            {
                // only left eye is opened
                this.eyesOpenedQueue.Enqueue(EyesOpened.Left);
                eyesClosedCounter  = eyesClosedCounter / 3;
                eyesClosedDuration = 0;
            }
            else if (!lastEyePosition.LeftEye.IsValid && lastEyePosition.RightEye.IsValid)
            {
                // only right eye is opened
                this.eyesOpenedQueue.Enqueue(EyesOpened.Right);
                eyesClosedCounter  = eyesClosedCounter / 3;
                eyesClosedDuration = 0;
            }
            else
            {
                // both eyes opened
                this.eyesOpenedQueue.Enqueue(EyesOpened.Both);
                eyesClosedCounter  = eyesClosedCounter / 3;
                eyesClosedDuration = 0;
            }

            // calculate the amount of each eye-State in the queue!
            if (this.eyesOpenedQueue.Count > 30)
            {
                EyesOpened[] eyesOpenedArray = this.eyesOpenedQueue.ToArray();
                int          noneCount       = 0;
                int          leftCount       = 0;
                int          rightCount      = 0;
                int          bothCount       = 0;

                foreach (EyesOpened eyesOpened in eyesOpenedArray)
                {
                    switch (eyesOpened)
                    {
                    case EyesOpened.None:
                    {
                        noneCount++;
                        break;
                    }

                    case EyesOpened.Left:
                    {
                        leftCount++;
                        break;
                    }

                    case EyesOpened.Right:
                    {
                        rightCount++;
                        break;
                    }

                    case EyesOpened.Both:
                    {
                        bothCount++;
                        break;
                    }
                    }
                }


                // check which left-eye / right-eye objects should be visible
                if (noneCount >= leftCount && noneCount >= rightCount && noneCount >= bothCount)
                {
                    // "none" was most often recognized
                    this.hideLeftEyeObjects();
                    this.hideRightEyeObjects();
                }
                else if (leftCount >= rightCount && leftCount >= bothCount)
                {
                    // "left" was most often recognized
                    this.showLeftEyeObjects();
                    this.hideRightEyeObjects();
                }
                else if (rightCount >= bothCount)
                {
                    // "right" was most often recognized
                    this.hideLeftEyeObjects();
                    this.showRightEyeObjects();
                }
                else
                {
                    // "both" was most often recognized
                    this.hideLeftEyeObjects();
                    this.hideRightEyeObjects();
                }

                this.eyesOpenedQueue.Dequeue();
            }

            // check whether bridge should be broad or not
            // make bridge wider if both eyes are closed
            GameObject bridge = GameObject.Find("Bridge");

            if (eyesClosedCounter > 24)
            {
                bridge.transform.localScale = new Vector3(1, 1, 6);
                GameObject.Find("BridgeCollider").GetComponent <BoxCollider> ().enabled = false;
                //GetComponent<BridgeCollider>().enabled = false;
            }
            else
            {
                bridge.transform.localScale = new Vector3(1, 1, 1.0f);
                GameObject.Find("BridgeCollider").GetComponent <BoxCollider> ().enabled = true;
                //GetComponent<BridgeCollider>().enabled = true;
            }
        }
    }
Example #10
0
    void Update()
    {
        elapsedTime += Time.deltaTime;


        // play the wakeup sound
        if (timeTillWakeupSoundStarts < elapsedTime && wakeupSoundPlayed == false)
        {
            wakeupSoundPlayed = true;

            //Debug.Log ("Wakeup sound queued");
            AudioManager.instance.queueAudioClip(audioFiles.wakeupAudioClip);
        }


        // If the wall trigger was triggered then start the countdown till the voice should start
        if (wallTriggerStarted)
        {
            timeTillWallSoundStarts -= Time.deltaTime;

            if (wallSoundPlayed == false && timeTillWallSoundStarts < 0)
            {
                // play Audio Sound
                wallSoundPlayed = true;
                AudioManager.instance.queueAudioClip(audioFiles.firstWallAudioClip);
            }
        }


        // open the door if the time is right!
        if (elapsedTime > timeTillFirstDoorOpens && !openFirstDoorAnimationStarted)
        {
            openFirstDoorAnimationStarted = true;
            GameObject.Find("FirstDoor").GetComponent <Animator>().Play("OpenDoor");
        }


        // after the firstWallAudioClip was played check if the player closes his eyes for a second
        if (wallSoundPlayed && !wallsVisible)
        {
            // check whether left and right eye are closed
            EyeXEyePosition lastEyePosition = eyePositionDataProvider.Last;

            //Debug.Log ("lastEyePosition: " + lastEyePosition);

            if (!lastEyePosition.RightEye.IsValid && !lastEyePosition.LeftEye.IsValid)
            {
                timeEyesAreClosed += Time.deltaTime;
            }
            else
            {
                timeEyesAreClosed = 0.0f;
            }

            if (timeEyesAreClosed > 1.0f)
            {
                // show the walls
                GameObject.Find("Level_1_Obstacle_Wall_01").GetComponent <MeshRenderer>().enabled = true;
                GameObject.Find("Level_1_Obstacle_Wall_02").GetComponent <MeshRenderer>().enabled = true;
                GameObject.Find("Level_1_Obstacle_Wall_03").GetComponent <MeshRenderer>().enabled = true;
                GameObject.Find("Level_1_Obstacle_Wall_04").GetComponent <MeshRenderer>().enabled = true;

                wallsVisible = true;
            }
        }



        // if the walls are passed send out rays to check whether the player is looking at a "solar panel"
        if (wallsVisible)
        {
            EyeXGazePoint gazePoint = gazePointDataProvider.Last;
            //Debug.Log ("last Gaze Point: " + gazePoint);
            Vector2 screenCoordinates = gazePoint.Screen;

            Ray gazeRay = Camera.main.ScreenPointToRay(new Vector3(screenCoordinates.x, screenCoordinates.y, 0));
            Debug.DrawRay(gazeRay.origin, gazeRay.direction, Color.magenta, 120.0f);
            if (Physics.Raycast(gazeRay.origin, gazeRay.direction, out gazeRaycastHit, 40.0f))
            {
                string gazedObject = gazeRaycastHit.collider.gameObject.name;

                if (gazedObject.Contains("Panel_Colored"))
                {
                    Debug.Log("Panel gazed");
                    Debug.Log("gazedObject: " + gazedObject);
                    Debug.Log("currentBlinkingLight: " + currentBlinkingLight);

                    if (gazedObject == currentBlinkingLight && currentBlinkingLightRemoved == false)
                    {
                        Debug.Log("Blinking Panel gazed");
                        ((GameObject)blinkingLights[currentBlinkingLightIndex]).GetComponentInChildren <MeshRenderer>().enabled = false;
                        blinkingLights.RemoveAt(currentBlinkingLightIndex);
                        currentBlinkingLightRemoved = true;
                    }
                }
            }
        }


        GameObject.Find("Cow").GetComponentInChildren <MeshRenderer> ().material.color = Color.Lerp(Color.magenta, Color.blue, elapsedTime % 10 / 10.0f);



        blinkingLightCounter += Time.deltaTime;

        if (blinkingLightCounter > 2.75f)
        {
            blinkingLightCounter = 0.0f;
            blinkLight();
        }
    }
Example #11
0
    private void handlePanelRiddle()
    {
        Debug.Log("handlePanelRiddle");
        this.timeSinceLastPanelRiddleHint += Time.deltaTime;

        EyeXGazePoint   gazePoint   = gazePointDataProvider.Last;
        EyeXEyePosition eyePosition = this.eyePositionDataProvider.Last;

        // check if both eyes are opened, only then retreive the last gazePoint
        if (/*!gazePoint.Screen.Equals (this.previousGazePoint.Screen)*/ true)
        {
            Vector2 screenCoordinates = gazePoint.Screen;

            Ray gazeRay = Camera.main.ScreenPointToRay(new Vector3(screenCoordinates.x, screenCoordinates.y, 0));
            Debug.DrawRay(gazeRay.origin, gazeRay.direction, Color.magenta, 120.0f);

            //Ray debugRay = Camera.main.ScreenPointToRay (new Vector3(Screen.width / 2.0f, Screen.height / 2.0f, 0.0f));
            //Debug.DrawRay (debugRay.origin, debugRay.direction, Color.magenta, 120.0f);

            if (Physics.Raycast(gazeRay.origin, gazeRay.direction, out gazeRaycastHit, 40.0f, ~raycastMask))
            {
                //if (Physics.Raycast (debugRay.origin, debugRay.direction, out gazeRaycastHit, 40.0f)) {
                string gazedObject = gazeRaycastHit.collider.gameObject.name;

                // colorize the border of the wall-panel
                if (gazedObject.Contains("Panel"))
                {
                    gazeRaycastHit.collider.gameObject.GetComponent <GazePanel>().didGazePanel();
                    Debug.Log("didGazePanel");
                }


                // check if the gazed panel is the one that is currently lerping
                if (gazedObject == ((GameObject)blinkingLights [blinkingLightIndex]).name)
                {
                    // the gazed object is the one that is currently lerping
                    Debug.Log("gazing currently lerped panel");

                    if (currentLerpTimePaused == false)
                    {
                        currentLerpTimePaused             = true;
                        gazeStartedPanelColor             = ((GameObject)blinkingLights [blinkingLightIndex]).GetComponentInChildren <MeshRenderer> ().material.color;
                        this.continuesPanelDisgazeCounter = 0.0f;
                    }
                }
                else
                {
                    this.continuesPanelDisgazeCounter += Time.deltaTime;
                }

                // check if player gazed the goal
                if (gazedObject.Equals("Outer") || gazedObject.Equals("GoalDoor"))
                {
                    // if goal collider was gazed play a hint
                    if (this.panelRiddleHintsPlayed == 0)
                    {
                        AudioManager.instance.playAudioClipIfFree(audioFiles.getLocked_Stage01_AudioClip());
                        this.panelRiddleHintsPlayed++;
                    }
                    else
                    {
                        if (this.timeSinceLastPanelRiddleHint > 10.0f)
                        {
                            AudioManager.instance.playAudioClipIfFree(audioFiles.getLocked_Stage02_AudioClip());
                            this.timeSinceLastPanelRiddleHint = 0.0f;
                            this.panelRiddleHintsPlayed++;
                        }
                    }
                }
            }
            else
            {
                Debug.Log("else from raycast if");
                this.continuesPanelDisgazeCounter += Time.deltaTime;
            }
        }
        else
        {
            this.continuesPanelDisgazeCounter += Time.deltaTime;
            Debug.Log("equal locations");
        }

        this.previousGazePoint = gazePoint;

        if (this.continuesPanelDisgazeCounter > 0.3f)
        {
            this.continuesPanelDisgazeCounter = 0.0f;
            this.currentLerpTimePaused        = false;
            this.currentGazedLerpTime         = 0.0f;
        }



        if (currentLerpTimePaused)
        {
            // if the current lerp time is paused this means the user is looking at the panel
            float lerpValue = this.currentGazedLerpTime / this.gazedColorLerpTime;
            //((GameObject) blinkingLights[this.blinkingLightIndex]).GetComponentInChildren<MeshRenderer>().material.color = Color.Lerp (this.gazeStartedPanelColor, this.gazePanelColor, lerpValue);
            // if the line above is in comment it is the version without lerping
        }        /* else */ /* without else: version without lerping, with else: version with lerping when staring at the panel*/
        if (currentLerpTime < standardColorLerpTime / 2.0f)
        {
            // fade-in lerp animation
            float lerpValue = this.currentLerpTime / (this.standardColorLerpTime / 2.0f);
            ((GameObject)blinkingLights [blinkingLightIndex]).GetComponentInChildren <MeshRenderer> ().material.color = Color.Lerp(this.standardPanelColor, this.highlightedPanelColor, lerpValue);
        }
        else
        {
            //Debug.Log("lerp out");
            ((GameObject)blinkingLights [blinkingLightIndex]).GetComponentInChildren <MeshRenderer> ().material.color = Color.Lerp(this.highlightedPanelColor, this.standardPanelColor, this.currentLerpTime / (this.standardColorLerpTime / 2.0f) - 1.0f);
        }



        // Version where you stare at the light without lerping the color while watching
        currentLerpTime += Time.deltaTime;
        if (currentLerpTime > standardColorLerpTime)
        {
            currentLerpTime = 0.0f;
            blinkLight();
        }

        if (currentLerpTimePaused)
        {
            // lerp time paused, use the gazedLerpTime
            this.currentGazedLerpTime += Time.deltaTime;
            if (this.currentGazedLerpTime > this.gazeToLockTime)
            {
                // call the method to delete the object from the array and mark it as done!
                this.activatePanel();
            }
        }


        /*
         *              // version where you stare at the light and it lerps
         *      if (!currentLerpTimePaused) {
         *              currentLerpTime += Time.deltaTime;
         *              if (currentLerpTime > standardColorLerpTime) {
         *                      currentLerpTime = 0.0f;
         *                      blinkLight ();
         *              }
         *
         *      } else {
         *              // lerp time paused, use the gazedLerpTime
         *              this.currentGazedLerpTime += Time.deltaTime;
         *              if (this.currentGazedLerpTime > gazedColorLerpTime) {
         *                      // call the method to delete the object from the array and mark it as done!
         *                      this.activatePanel();
         *              }
         *      }*/
    }
        void GetEyesPosition()
        {
            if (PlayMakerEyexEyePositionDataProxy.Instance == null)
            {
                LogError("Missing 'PlayMaker Tobii Eyex' prefab instance in Scene!");
                Fsm.Event(errorEvent);
                return;
            }

            _pos = PlayMakerEyexEyePositionDataProxy.Instance.LastEyePosition;

            if (!isValid.IsNone)
            {
                isValid.Value = _pos != null?_pos.IsValid:false;
            }

            if (_pos != null && _pos.IsValid)
            {
                if (!leftEyeIsValid.IsNone)
                {
                    leftEyeIsValid.Value = _pos.LeftEye.IsValid;
                }

                if (!leftEyePosition.IsNone && _pos.LeftEye.IsValid)
                {
                    leftEyePosition.Value = new Vector3(_pos.LeftEye.X, _pos.LeftEye.Y, _pos.LeftEye.Z);
                }

                if (!leftEyePositionNormalized.IsNone && _pos.LeftEye.IsValid)
                {
                    leftEyePositionNormalized.Value = new Vector3(1f - _pos.LeftEyeNormalized.X, 1f - _pos.LeftEyeNormalized.Y, 1f - _pos.LeftEyeNormalized.Z);
                }

                if (!rightEyeIsValid.IsNone)
                {
                    rightEyeIsValid.Value = _pos.RightEye.IsValid;
                }

                if (!rightEyePosition.IsNone && _pos.RightEye.IsValid)
                {
                    rightEyePosition.Value = new Vector3(_pos.RightEye.X, _pos.RightEye.Y, _pos.RightEye.Z);
                }

                if (!righEyePositionNormalized.IsNone && _pos.RightEye.IsValid)
                {
                    righEyePositionNormalized.Value = new Vector3(1f - _pos.RightEyeNormalized.X, 1f - _pos.RightEyeNormalized.Y, 1f - _pos.RightEyeNormalized.Z);
                }
            }
            else
            {
                if (!leftEyeIsValid.IsNone)
                {
                    leftEyeIsValid.Value = false;
                }

                if (!rightEyeIsValid.IsNone)
                {
                    rightEyeIsValid.Value = false;
                }
            }
        }