Ejemplo n.º 1
0
 public virtual void Update()
 {
     if (needsimNode.AnimationsToPlay.Count > 0)
     {
         if (needsimNode.AnimationsToPlay.Peek() == NEEDSIM.NEEDSIMNode.AnimationOrders.MovementStartedByAgent)
         {
             //Rotate agent into movement direction
             gameObject.transform.LookAt(needsimNode.GetComponent <UnityEngine.AI.NavMeshAgent>().steeringTarget);
             gameObject.transform.Rotate(90.0f, gameObject.transform.rotation.y, gameObject.transform.rotation.z);
         }
         else if (needsimNode.AnimationsToPlay.Peek() == NEEDSIM.NEEDSIMNode.AnimationOrders.InteractionStartedByAgent)
         {
             //Rotate agent towards LookAt
             gameObject.transform.LookAt(needsimNode.Blackboard.activeSlot.LookAt);
         }
         //This method will call the SetTrigger method on the animator, thus triggering correctly named transitions into animation states.
         needsimNode.TryConsumingAnimationOrder(animator);
     }
 }
Ejemplo n.º 2
0
 public virtual void Update()
 {
     if (needsimNode.AnimationsToPlay.Count > 0)
     {
         if (needsimNode.AnimationsToPlay.Peek() == NEEDSIM.NEEDSIMNode.AnimationOrders.MovementStartedByAgent)
         {
             //Rotate agent into movement direction
             gameObject.transform.LookAt(navMeshAgent.steeringTarget);
             gameObject.transform.Rotate(90.0f, gameObject.transform.rotation.y, gameObject.transform.rotation.z);
             //animator.rootPosition = navMeshAgent.desiredVelocity;
             animator.SetFloat("Speed", navMeshAgent.desiredVelocity.magnitude);
         }
         else if (needsimNode.AnimationsToPlay.Peek() == NEEDSIM.NEEDSIMNode.AnimationOrders.InteractionStartedByAgent)
         {
             //Rotate agent towards LookAt
             gameObject.transform.LookAt(needsimNode.Blackboard.activeSlot.LookAt);
         }
         //This method will call the SetTrigger method on the animator, thus triggering correctly named transitions into animation states.
         needsimNode.TryConsumingAnimationOrder(animator);
     }
 }