So ive tried several different methods for enabling a backwards moving animation when i am moving backwards the animation will activate when the attackanimation speed float reaches 12 however i cant seem to get this to work and im sure there is an easier way
this is the animation portion of my script
void Animate()
{
if (Input.GetKey(KeyCode.LeftShift))
{
attackanimaton.SetFloat("Speed", 9.0f);
navAgent.speed = 7;
}
if (Input.GetAxis("Horizontal") > 0 || Input.GetAxis("Vertical") > 0)
{
attackanimaton.SetBool("isAttacking", false);
attackanimaton.SetFloat("Speed", 6.0f);
navAgent.speed = 4;
}
else if (navAgent.velocity.magnitude < 1.0f && (!Input.GetKey(KeyCode.LeftShift)))
{
navAgent.speed = 1;
attackanimaton.SetFloat("Speed", 1.0f);
}
}
movement script
void movement()
{
var x = Input.GetAxis("Horizontal") * Time.deltaTime * 150.0f;
var z = Input.GetAxis("Vertical") * Time.deltaTime * walkspeedstat;
transform.Rotate(0, x, 0);
transform.Translate(0, 0, z);
}