using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class EnemyController : MonoBehaviour {
NavMeshAgent;
Transform player;
Animator controller;
// Use this for initialization
void Awake () {
Nav = GetComponet ();
player = GameObject.FindGameObjectWithTag (“Player”).transform;
controller = GetComponetInParent();
}
// Update is called once per frame
void Update () {
nav.SetDestination (player.position);
controller.SetFloat ("speed", Mathf.nav.velocity.x + Mathf.nav.velocity.z);
}
}