Beispiel #1
0
        IEnumerator CheckFacialAnimFinished(float animPeriod)
        {
            float elapsedTime = 0f;

            while (elapsedTime <= animPeriod)
            {
                elapsedTime += Time.deltaTime;
                yield return(null);
            }

            currentFacialInfo = null;
            if (facialQueue.Count > 0)
            {
                //Play(facialQueue.Dequeue());
                RobotFacialInfo info = facialQueue[0];
                facialQueue.RemoveAt(0);
                Play(info);
            }
            else
            {
                bool isSpeaking = SpeechRenderrer.Instance.IsSpeaking;
                //bool isActive = webSurvey.GetBehaviorMode == WebSurvey.Mode.Active;

                string faceName = string.Empty;
                if (isSpeaking && surveyController.GetFaceActiveState)
                {
                    faceName = "speak";
                }

                else if (!isSpeaking && surveyController.GetFaceActiveState)
                {
                    faceName = "normal_active";
                    //Debug.Log("Set Normal Active");
                }

                else if (!surveyController.GetFaceActiveState)
                {
                    faceName = "normal_inactive";
                }

                RobotFacialInfo info = new RobotFacialInfo(faceName, 1.0f);
                Play(info);
            }
        }
Beispiel #2
0
        private void Play(RobotFacialInfo info)
        {
            //Debug.Log("Added to facial queue: " + info.faceName);

            // Test.
            if (currentFacialInfo != null)
            {
                //facialQueue.Enqueue(info);
                facialQueue.Add(info);
                return;
            }

            currentFacialInfo = info;
            SetFacialModel(info.faceName);
            robotFacialAnimator.PlayFacialAnim(info.faceName, info.animPeriod);

            StartCoroutine(CheckFacialAnimFinished(info.animPeriod));

            // 현재 표정 저장.
            currentFace = info.faceName;

            surveyController.behaviorRecorder.RecordBehavior(new Recorder.RecordEvent(1, info.faceName));
        }