Enemy_AI
This script is use for enemy Follow to playerusing System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AI;
public class Enemy_AI : MonoBehaviour {
public GameObject player;
public bool isDead = false;
Animator anim;
NavMeshAgent nav;
// Use this for initialization
void Start () {
{
anim = GetComponent<Animator>();
nav = GetComponent<NavMeshAgent>();
}
isDead = false;
}
// Update is called once per frame
void FixedUpdate ()
{
if (isDead)
{
nav.enabled = false;
} else {
nav.SetDestination (player.transform.position);
}
}
}
No comments:
Post a Comment