Sunday, February 3, 2019

Unity 3d Enemy_AI Script enemy follow to player by allunityscripts

Enemy_AI

                                             This script is use for enemy Follow to player

zombie ai script





using 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