Ejemplo n.º 1
0
    public void DoTalking(TalkState talkState)
    {
        if (talkState == TalkState.TALK_START)
        {
//            storedMood = animator.GetInteger("Mood");
//            storedMoodIntensity = animator.GetFloat("Mood Intensity");
            if (ApproachNeutral)
            {
                SetMood(EmotionalState.NEUTRAL, 0.0f);
            }
            if (ApproachLowerIntensity)
            {
                if (BubbleSystemUtility.CheckCoroutine(ref corrotina))
                {
                    StopCoroutine(corrotina);
                }

                corrotina = MoodTransition(animator.GetFloat("Mood Intensity"), animator.GetFloat("Desired Intensity") * 0.5f, 1.0f);
                StartCoroutine(corrotina);
            }
            //SetMood((EmotionalState)storedMood, (storedMoodIntensity / parameters.getMoodDampenerValue())*0.5f, 1.0f);
        }
        else
        {
            if (ApproachNeutral || ApproachLowerIntensity)
            {
                if (BubbleSystemUtility.CheckCoroutine(ref corrotina))
                {
                    StopCoroutine(corrotina);
                }
                corrotina = MoodTransition(animator.GetFloat("Mood Intensity"), animator.GetFloat("Mood Intensity") / 0.5f, 1.0f);
                StartCoroutine(corrotina);
            }

            //SetMood((EmotionalState)storedMood, storedMoodIntensity / parameters.getMoodDampenerValue(), 1.0f);
        }

        animator.SetInteger("Talk State", (int)talkState);
        animator.SetTrigger("Talk");
    }
Ejemplo n.º 2
0
    public void SetMood(EmotionalState mood, float intensity, float duration = 2.0f)
    {
        float finalIntensity = intensity;

        float[][] preset;

        switch (mood)
        {
        case EmotionalState.NEUTRAL:
            preset = AvatarParameters.Presets.Neutral();
            break;

        case EmotionalState.HAPPINESS:
            if (finalIntensity > LOWINTENSITYTHRESHOLD)
            {
                preset = AvatarParameters.Presets.HappinessHigh();
            }
            else
            {
                preset = AvatarParameters.Presets.HappinessLow();
            }
            break;

        case EmotionalState.SADNESS:
            if (finalIntensity > LOWINTENSITYTHRESHOLD)
            {
                preset = AvatarParameters.Presets.SadnessHigh();
            }
            else
            {
                finalIntensity = finalIntensity * 0.3f;
            }
            preset = AvatarParameters.Presets.SadnessLow();
            break;

        case EmotionalState.FEAR:
            preset = AvatarParameters.Presets.Fear();
            break;

        case EmotionalState.SURPRISE:
            preset = AvatarParameters.Presets.Surprise();
            break;

        case EmotionalState.ANGER:
        case EmotionalState.DISGUST:
        default:
            preset = AvatarParameters.Presets.Neutral();
            break;
        }

        parameters.setAllParameters <AnimatorParams>(preset[0]);
        parameters.setAllParameters <ControllerParams>(preset[1]);
        finalIntensity = finalIntensity * parameters.getMoodDampenerValue();

        if (BubbleSystemUtility.CheckCoroutine(ref corrotina))
        {
            StopCoroutine(corrotina);
        }
        corrotina = MoodTransition(animator.GetFloat("Mood Intensity"), finalIntensity, duration);
        StartCoroutine(corrotina);

        animator.SetInteger("Mood", (int)mood);

        animator.SetFloat("Desired Intensity", finalIntensity);
    }