Esempio n. 1
0
        public void SelectExpression(float intensity, float maxIntensity, float desiredIntensity)
        {
            if (expressions == null)
            {
                return;
            }

            Expression nextExpression = expressions.Next();

            if (nextExpression != null && nextExpression.ShouldPlay(intensity, maxIntensity, desiredIntensity) && nextExpression != lastPlayedExpression)
            {
                foreach (string key in facialKeys)
                {
                    Facial f = facial[key];
                    f.shouldFade = false;
                }

                lastPlayedExpression = nextExpression;
                nextExpression.TriggerFacial(0);


                float nextDuration = nextExpression.audioClip.sourceClip.length;
                headAudioSource.PlayNow(nextExpression.audioClip);

                jawAdjust.driveXRotationFromAudioSource = !nextExpression.keepMouthClosed;

                nextPlayTime = Time.fixedTime + UnityEngine.Random.Range(nextDuration, nextDuration + 1.0f);
            }

            jawAdjust.driveXRotationFromAudioSourceMultiplier      = 115.0f;
            jawAdjust.driveXRotationFromAudioSourceAdditionalAngle = 0.0f;
            jawAdjust.driveXRotationFromAudioSourceMaxAngle        = -5.0f;
        }
Esempio n. 2
0
 public void Update()
 {
     foreach (string key in facialKeys)
     {
         Facial f = facial[key];
         f.Update();
     }
 }
Esempio n. 3
0
        public void StartPanting(float duration)
        {
            panting.TriggerFacial(duration);
            headAudioSource.PlayNow(panting.audioClip);

            foreach (string key in facialKeys)
            {
                Facial f = facial[key];
                f.shouldFade = true;
            }
        }
Esempio n. 4
0
        public void SelectClimax(float duration)
        {
            foreach (string key in facialKeys)
            {
                Facial f = facial[key];
                f.shouldFade = false;
            }

            Expression climax = climaxes.Next();

            climax.TriggerFacial(duration);
            headAudioSource.PlayNow(climax.audioClip);
            nextPlayTime = Time.fixedTime + Mathf.Max(duration, climax.audioClip.sourceClip.length) + UnityEngine.Random.Range(2.0f, 4.0f);
        }
Esempio n. 5
0
        public void StartBreathing(Breathe breath, float duration)
        {
            if (panting == null)
            {
                Debug.Log("panting");
                return;
            }
            if (breathingIdle == null)
            {
                Debug.Log("idle");
                return;
            }
            if (breathingActive == null)
            {
                Debug.Log("active");
                return;
            }
            if (breath.breath > 0.6f)
            {
                panting.TriggerFacial(duration);
                headAudioSource.PlayNow(panting.audioClip);
            }
            else
            if (breath.breath > 0.3f)
            {
                breathingActive.TriggerFacial(duration);
                headAudioSource.PlayNow(breathingActive.audioClip);
            }
            else
            {
                breathingIdle.TriggerFacial(duration);
                headAudioSource.PlayNow(breathingIdle.audioClip);
            }

            foreach (string key in facialKeys)
            {
                Facial f = facial[key];
                f.shouldFade = true;
            }
        }