コード例 #1
0
ファイル: ManageLogs.cs プロジェクト: iRandz/EyeTracking
    // Private functions --------------------------------
    private IEnumerator LookBetween_Coroutine() // Makes the light look at the player, a log, and then the fireplace
    {
        if (woodenLogs.Count < 1)
        {
            yield break;
        }

        int rng = Random.Range(0, woodenLogs.Count - 1);

        continueRepeating = true;
        while (continueRepeating)
        {
            _lightManager.SetGazetypeResetAndCurrent(LookAt.LookTypes.lookAtPlayer, LookAt.LookTypes.lookAtPlayer);
            _lightManager.ForceInstantMove();
            yield return(new WaitForSeconds(timePlayer));// Consider swapping this timer with a reaction to the player's gaze.

            if (woodenLogs.Count < 1 || !continueRepeating)
            {
                yield break;
            }

            _lightManager.SetCurrentLightGazeToObject(woodenLogs[rng], false);
            _lightManager.ForceInstantMove();
            yield return(new WaitForSeconds(timeLog));

            if (!continueRepeating)
            {
                break;
            }

            _lightManager.SetCurrentLightGazeToObject(this.transform, false);
            _lightManager.ForceInstantMove();
            yield return(new WaitForSeconds(timeFire));
        }
        // _lightManager.SetGazetypeResetAndCurrent(LookAt.LookTypes.stareAtObject, LookAt.LookTypes.stareAtObject);
        // _lightManager.ForceInstantMove();
    }
コード例 #2
0
    // Update is called once per frame
    void Update()
    {
        if (_evalCondition.EyeTracking)
        {
            if (!_gazeAwareComponent.HasGazeFocus) //&& !notLookingAtBooks)
            {
                timer            += Time.deltaTime;
                notLookingAtBooks = true;
                lookingAtBooks    = false;
                if (timer > lookAwayTimer && !stopAtOneBook && !win)
                {
                    //Debug.Log(timer);
                    if (ListOfBooks.Count > 0)
                    {
                        ListOfBooks[ListOfBooks.Count - 1].throwOfShelf();
                        bookThrown.Invoke();
                    }
                    _bookShelfInteraction.interactionEventRun = false;
                    timer         = 0;
                    stopAtOneBook = true;
                }
            }
            else if (_gazeAwareComponent.HasGazeFocus && firstBookAdded)
            {
                randomTimer += Time.deltaTime;
                if (randomTimer > randomWaitTime)
                {
                    _lightManager.SetGazetypeResetAndCurrent(LookAt.LookTypes.alternateObjects,
                                                             LookAt.LookTypes.distractingGaze);
                    _lightManager.ForceInstantMove();
                    randomTimer    = 0;
                    randomWaitTime = Random.Range(minDistractionWait, maxDistractionWait);
                }

                notLookingAtBooks = false;
                lookingAtBooks    = true;
                timer             = 0;
            }
        }
        else if (!_evalCondition.EyeTracking && !evalFalseRunOne)
        {
            //DOES IT NEED TO DISTRACT?
        }
    }