Синтаксис:
Используется csharp
public NavMeshAgent agent;
private Transform player;
public Animator animator;
// Use this for initialization
void Start () {
player = GameObject.FindGameObjectWithTag("Player").transform;
}
// Update is called once per frame
void Update () {
animator.SetBool("Walk", true);
agent.SetDestination(player.position);
if(Vector3.Distance(transform.position, player.position) < 5f)
{
animator.SetBool("Walk", false);
agent.Stop();
}
}
}