Controlando Animações
public class Player : MonoBehaviour {
public float WalkSpeed = 70;
public float RotationSpeed = 50;
private Animator animator;
private CharacterController ch;
void Start(){
animator = GetComponent<Animator>();
ch = GetComponent<CharacterController>();
}
void Update(){
float forwardMove = Input.GetAxis("Vertical");
float rotation = Input.GetAxis("Horizontal");
animator.SetFloat("Speed", forwardMove);
ch.SimpleMove(transform.forward * forwardMove *
WalkSpeed * Time.deltaTime);
transform.Rotate(Vector3.up * rotation *
RotationSpeed * Time.deltaTime);
}
}