Another approach for the walk/run speed

Hi there,

I used a slightly different approach…

I created a new methode in the Mover.cs to set the speed:

public void SetSpeed(float speedFraction)
{
navMeshAgent.speed = maxSpeed * Mathf.Clamp01(speedFraction);
}

After that I just set the new speed at the beginning of the attack/patrol behaviour with this methode.

Though, I do like the idea of not setting it to an absolute value and instead do a fraction of it!

I don’t know if there is any downside to it, but I prefer to have it decoupled from the StartMoveAction/MoveTo methode. Also I didn’t have to look through the code to rewrite the existing methode implementations.

Best regards,
Manuel

2 Likes

Privacy & Terms