Ejemplo n.º 1
0
 private void Update()
 {
     if (newResult)
     {
         ChatBox.text = newResultString;
         newResult    = false;
     }
     if (justConnected)
     {
         changeTextBox(true);
         justConnected = false;
     }
     if (justDisConnected)
     {
         changeTextBox(false);
         justDisConnected = false;
     }
     if (updateGazeTarget)
     {
         gaze.SetGazeToQuadrant(gazeTarget);
         AutonomousGazeBehavior.Instance.EventUserLookingAtQuadrantOrPlayer(gazeTarget);
         updateGazeTarget = false;
     }
 }
    public void performGaze(GazeState gazeState, string target)
    {
        if (furhat.Asleeep)
        {
            return;
        }
        if (keepTrackingPlayerCoroutine != null)
        {
            StopCoroutine(keepTrackingPlayerCoroutine);
        }
        if (autoGazeCoroutine != null)
        {
            StopCoroutine(autoGazeCoroutine);
        }
        currentGazeTarget = gazeState;
        Dbg.Log(LogMessageType.ROBOT_GAZE_TARGET, new List <string>()
        {
            gazeState.ToString(), target
        });
        switch (gazeState)
        {
        case GazeState.ROBOT_DISTRACTED:
            furhatInterfaceGaze.SetGaze(DistractedGazeTarget.transform.position);
            furhat.Gaze(DistractedPointsToLookAt[UnityEngine.Random.Range(0, DistractedPointsToLookAt.Count)]);
            autoGazeCoroutine = StartCoroutine(WaitForAutoGazeTest(TimesAutoDistracted));
            break;

        case GazeState.ROBOT_LOOKING_AT_PLAYER:
            furhatInterfaceGaze.SetGaze(PlayerGazeTarget.transform.position);
            keepTrackingPlayerCoroutine = StartCoroutine(keepTrackingPlayer());
            autoGazeCoroutine           = StartCoroutine(WaitForAutoGazeTest(TimesAutoPlayer));
            break;

        case GazeState.ROBOT_LOOKING_AT_QUADRANT:
            furhatInterfaceGaze.SetGazeToQuadrant(target);
            furhat.gaze(target);
            autoGazeCoroutine = StartCoroutine(WaitForAutoGazeTest(TimesAutoQuadrant));
            break;

        case GazeState.EVENT_PLAYER_STARTED_SPEAKING:
            furhatInterfaceGaze.SetGaze(PlayerGazeTarget.transform.position);
            keepTrackingPlayerCoroutine = StartCoroutine(keepTrackingPlayer());
            autoGazeCoroutine           = StartCoroutine(WaitForAutoGazeTest(TimesLookingAtUserSpeaking));
            break;

        case GazeState.EVENT_PIECE_MOVED:
            furhatInterfaceGaze.SetGazeToPiece(target);
            furhat.gaze(target);
            autoGazeCoroutine = StartCoroutine(WaitForAutoGazeTest(TimesBoardEvents));
            break;

        case GazeState.EVENT_PLAYER_LOOKING_AT_QUADRANT:
            furhatInterfaceGaze.SetGazeToPiece(target);
            furhat.gaze(target);
            autoGazeCoroutine = StartCoroutine(WaitForAutoGazeTest(TimesLookingAtQuadrant));
            break;

        case GazeState.EVENT_PLAYER_LOOKING_AT_ROBOT:
            furhatInterfaceGaze.SetGaze(PlayerGazeTarget.transform.position);
            keepTrackingPlayerCoroutine = StartCoroutine(keepTrackingPlayer());
            autoGazeCoroutine           = StartCoroutine(WaitForAutoGazeTest(TimesLookingAtRobotMimick));
            break;

        default:
            break;
        }
    }