using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerController: MonoBehaviour {

public float movementSpeed = 3;
Animator anim;

void Start() {
anim = GetComponent < Animator > ();
}

void Update() {
ControllPlayer();
}

void ControllPlayer() {
float moveHorizontal = Input.GetAxisRaw("Horizontal");
float moveVertical = Input.GetAxisRaw("Vertical");

Vector3 movement = new Vector3(moveHorizontal, 0.0 f, moveVertical);

if (movement != Vector3.zero) {
transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.LookRotation(movement), 0.15 f);
anim.SetInteger("Walk", 1);
} else {
anim.SetInteger("Walk", 0);
}

transform.Translate(movement * movementSpeed * Time.deltaTime, Space.World);

}
}