Ejemplo n.º 1
0
    // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
    override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        gV            = animator.GetComponent <globalVars>();
        looker        = gV.interactionCanvas.GetComponent <Looker>();
        roboBehaviour = animator.GetComponent <RoboBehaviour>();

        gV.feedback = true;

        animator.ResetTrigger("originReached");
        animator.ResetTrigger("statesCorrect");
        animator.ResetTrigger("targetReached");
        animator.ResetTrigger("noHelpNeeded");
        animator.ResetTrigger("finished");
        animator.ResetTrigger("feedback");
        animator.ResetTrigger("unhappy");
        animator.ResetTrigger("findObject");

        looker.StartFeedbackDialog();

        float      happyValue = 1f;
        SeeEmotion seeEmotion = roboBehaviour.GetGazedBy().GetComponentInParent <SeeEmotion>();

        if (seeEmotion != null)
        {
            seeEmotion.emotions.TryGetValue(Emotion.Happy, out happyValue);
            if (happyValue < gV.happyThreshold)
            {
                gV.asked    = false;
                gV.feedback = false;
            }
        }
        animator.SetTrigger("finished");
    }
Ejemplo n.º 2
0
    // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
    override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        roboBehaviour = animator.GetComponent <RoboBehaviour>();
        gV            = animator.GetComponent <globalVars>();

        animator.ResetTrigger("originReached");
        animator.ResetTrigger("statesCorrect");
        animator.ResetTrigger("targetReached");
        animator.ResetTrigger("noHelpNeeded");
        animator.ResetTrigger("finished");
        animator.ResetTrigger("feedback");
        animator.ResetTrigger("unhappy");
        animator.ResetTrigger("findObject");

        if (gV.asked)
        {
            gV.asked    = false;
            gV.feedback = false;
            roboBehaviour.SetGaze(null);
        }
    }
Ejemplo n.º 3
0
    // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
    public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        navMeshAgent  = animator.GetComponent <NavMeshAgent>();
        roboBehaviour = animator.GetComponent <RoboBehaviour>();
        gV            = animator.GetComponent <globalVars>();

        animator.ResetTrigger("originReached");
        animator.ResetTrigger("statesCorrect");
        animator.ResetTrigger("targetReached");
        animator.ResetTrigger("noHelpNeeded");
        animator.ResetTrigger("finished");
        animator.ResetTrigger("feedback");
        animator.ResetTrigger("unhappy");
        animator.ResetTrigger("findObject");

        Vector3 follow = gV.destination;

        if (follow != null)
        {
            var     position        = follow;
            Vector3 directionVector = position - animator.transform.position;
            navMeshAgent.SetDestination(position - (directionVector.normalized * roboBehaviour.stopBefore));
        }
    }