Ejemplo n.º 1
0
 void Update()
 {
     //change the animation state's parameters based on unitbehavior information.
     dist = myunit.GetDestDifference();
     if (dist.magnitude > myunit.WtR && myunit.isMoving)  //running in this case, as nothing blocks our path.
     {
         myanim.SetBool("Moving", true);
         myanim.SetFloat("Velocity Z", 1);
         //myanim.speed = myunit.moveSpeed * myunit.speedmultiplier / 2.0f;
     }
     else if (dist.magnitude > 0.01f && myunit.isMoving)    //walking in this case, as we are approaching an obstacle or about to hit our destination.
     {
         myanim.SetBool("Moving", true);
         myanim.SetFloat("Velocity Z", myunit.speedmultiplier);
         //myanim.speed = myunit.moveSpeed * myunit.speedmultiplier /2.0f;
     }
     else
     {
         myanim.SetBool("Moving", false);
         myanim.SetFloat("Velocity Z", 0);
     }
 }