예제 #1
0
 // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
 override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     if (Vector3.Distance(waiter.transform.position, waiter.agent.destination) <= waiter.agent.stoppingDistance && !waiter.agent.isStopped)
     {
         waiter.agent.isStopped = true;
     }
     else if (waiter.agent.isStopped && looking < 1)
     {
         Vector3 look = waiter.currentTask.Coordinates.transform.position - waiter.transform.position;
         waiter.LookAt(look, looking);
         looking += Time.deltaTime;
     }
     else if (waiter.agent.isStopped && looking >= 1 && !cogiendo)
     {
         animator.SetTrigger("Coger");
         Debug.Log("Cogiendo");
         cogiendo = true;
         Encimera enci = waiter.currentTask.Coordinates.GetComponent <Encimera>();
         waiter.plato = enci.platoPrefab;
         waiter.plato.transform.parent        = waiter.coger;
         waiter.plato.transform.localPosition = Vector3.zero;
         waiter.plato.transform.localRotation = Quaternion.Euler(-90, 0, 0);
         enci.platoPrefab = null;
         enci.ocupado     = false;
     }
     else if (waiter.agent.isStopped && !animator.IsInTransition(0) && animator.GetCurrentAnimatorStateInfo(0).normalizedTime > 1)
     {
         animator.SetTrigger("Entregar");
         animator.SetTrigger("FinCoger");
         waiter.plato.transform.parent        = waiter.centroBandeja;
         waiter.plato.transform.localPosition = Vector3.zero;
         waiter.plato.transform.localRotation = Quaternion.Euler(-90, 0, 0);
     }
 }
예제 #2
0
 // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
 override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     if (Vector3.Distance(waiter.transform.position, waiter.agent.destination) <= waiter.agent.stoppingDistance && !waiter.agent.isStopped)
     {
         waiter.agent.isStopped = true;
     }
     else if (waiter.agent.isStopped && looking < 1)
     {
         waiter.LookAt(checkPoint.transform.forward, looking);
         looking += Time.deltaTime;
     }
     else if (waiter.agent.isStopped && looking >= 1 && !entregando)
     {
         animator.SetTrigger("Dejar");
         Debug.Log("Dejando");
         entregando = true;
     }
     else if (waiter.agent.isStopped && looking >= 1 && !animator.IsInTransition(0) && animator.GetCurrentAnimatorStateInfo(0).normalizedTime > 1)
     {
         checkPoint.ocupado = false;
         animator.SetTrigger("Idle");
         animator.SetTrigger("FinDejar");
         waiter.world.Notify(new Task("Cocinar", null, waiter, Task.Receptor.Cocinero, waiter.currentTask.Emisor.gameObject));
     }
 }
예제 #3
0
 // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
 override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     if (Vector3.Distance(waiter.transform.position, waiter.agent.destination) <= waiter.agent.stoppingDistance && !waiter.agent.isStopped)
     {
         waiter.agent.isStopped = true;
     }
     else if (waiter.agent.isStopped && looking < 1)
     {
         Vector3 look = waiter.currentTask.Emisor.transform.position - waiter.transform.position;
         waiter.LookAt(look, looking);
         looking += Time.deltaTime;
     }
     else if (waiter.agent.isStopped && looking >= 1 && !cobrando)
     {
         waiter.soundManager.Play("ClientePagar");
         waiter.dolar.SetActive(true);
         animator.SetTrigger("Interaccion");
         Debug.Log("Cobrando");
         cobrando = true;
     }
     else if (waiter.agent.isStopped && looking >= 1 && !animator.IsInTransition(0) && animator.GetCurrentAnimatorStateInfo(0).normalizedTime > 1)
     {
         waiter.dolar.SetActive(false);
         animator.SetTrigger("Idle");
         animator.SetTrigger("FinInteraccion");
         waiter.currentTask.Emisor.GetComponent <StandardAgent>().anim.SetTrigger("Irse");
     }
 }
예제 #4
0
 // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
 override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     if (Vector3.Distance(waiter.transform.position, waiter.agent.destination) <= waiter.agent.stoppingDistance && !waiter.agent.isStopped)
     {
         waiter.agent.isStopped = true;
     }
     else if (waiter.agent.isStopped && looking < 1)
     {
         Vector3 look = waiter.currentTask.extraInfo.GetComponent <ClientAgent>().mesa.GetComponent <Mesa>().posicionPlato.transform.position - waiter.transform.position;
         waiter.LookAt(look, looking);
         looking += Time.deltaTime;
     }
     else if (waiter.agent.isStopped && looking >= 1 && !dejando)
     {
         animator.SetTrigger("Dejar");
         Debug.Log("Dejando");
         dejando = true;
     }
     else if (waiter.agent.isStopped && !animator.IsInTransition(0) && animator.GetCurrentAnimatorStateInfo(0).normalizedTime > 1)
     {
         waiter.plato.transform.parent = waiter.currentTask.extraInfo.GetComponent <ClientAgent>().mesa.GetComponent <Mesa>().posicionPlato;
         waiter.currentTask.extraInfo.GetComponent <ClientAgent>().mesa.GetComponent <Mesa>().platoPrefab = waiter.plato;
         waiter.plato.transform.localPosition = Vector3.zero;
         waiter.plato.transform.localRotation = Quaternion.Euler(-90, 0, 0);
         waiter.currentTask.extraInfo.GetComponent <StandardAgent>().anim.SetTrigger("Comer");
         //waiter.currentTask.extraInfo.GetComponent<StandardAgent>().Notify(new Task("Comer",waiter.plato,waiter,Task.Receptor.Cliente));
         waiter.plato = null;
         animator.SetTrigger("Idle");
         animator.SetTrigger("FinDejar");
     }
 }
예제 #5
0
 // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
 override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     if (Vector3.Distance(waiter.transform.position, waiter.agent.destination) <= waiter.agent.stoppingDistance && !waiter.agent.isStopped)
     {
         waiter.agent.isStopped = true;
         Debug.Log("Parado");
     }
     else if (waiter.agent.isStopped && looking < 1)
     {
         waiter.LookAt(waiter.startForward, looking);
         looking += Time.deltaTime;
     }
     else if (waiter.currentTask != null)
     {
         animator.SetTrigger(waiter.currentTask.Id);
     }
 }
예제 #6
0
	// OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
	override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
        if (Vector3.Distance(waiter.transform.position, waiter.agent.destination) <= waiter.agent.stoppingDistance && !waiter.agent.isStopped)
        {            
            waiter.agent.isStopped = true;
            Debug.Log("Recogiendo");
        }
        else if (waiter.agent.isStopped && looking < 1)
        {
            Vector3 look = waiter.currentTask.Emisor.gameObject.transform.position - waiter.transform.position;
            waiter.LookAt(look, looking);
            looking += Time.deltaTime;
        }
        else if (waiter.agent.isStopped && looking >= 1 && !cogiendo)
        {
            System.Random r = new System.Random();
            cogiendo = true;
            int x = r.Next(1, 5);
            waiter.soundManager.Play("InteraccionF" + x);
            Debug.Log("Recogiendo");
            animator.SetTrigger("Interaccion");
        }
        else if (waiter.agent.isStopped && !animator.IsInTransition(0) && animator.GetCurrentAnimatorStateInfo(0).normalizedTime > 1)
        {
            if (times == 2)
            {
                animator.SetTrigger("Entregar");
                animator.SetTrigger("FinInteraccion");
            }
            else
            {
                System.Random r = new System.Random();
                int x = r.Next(1, 5);
                waiter.soundManager.Play("InteraccionF" + x);
                animator.SetTrigger("Interaccion");
                times++;
            }
        }
    }