Need health with AI
Hi, I'm working on a top-down shooter need help with the AI it works to a point. All spawn at different points but all the AI go to the same point of the wall to destroy try to get to you.
all the AI mess up go a lil crazy
Header("Defens")]
public Transform wall;
[Header("Gneral")]
public Transform player;
public float rotSpeed;
public float speed;
private GameManger gManger;
private ZombieHealth zombieHealth;
// Use this for initialization
void Start () {
gManger = GameManger.instance;
player = GameObject.FindGameObjectWithTag("Player").transform;
wall = GameObject.FindGameObjectWithTag("Wall").transform;
zombieHealth = GetComponent<ZombieHealth>();
}
// Update is called once per frame
void Update() {
if (gManger.gameOver == true || zombieHealth.zombieDie == true || gManger.pauseGame == true)
return;
transform.position += transform.forward * speed * Time.deltaTime;
if (wall != null)
{
transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.LookRotation(wall.position - transform.position), rotSpeed * Time.deltaTime);
}
else
{
transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.LookRotation(player.position - transform.position), rotSpeed * Time.deltaTime);
}
}
}
Thank you
Ok.. So. What exactly are you wanting? Your title does not match the description..
get the AI to work better try to get all of them to swarm the player not just got any were
Answer by Zynek · Nov 04, 2016 at 02:39 PM
Hi there, i reccomend checking out Apex AI tools on asset store and this vid: https://youtu.be/jse_ZleruJU
Your answer

Follow this Question
Related Questions
How do I make an enemy chase the player with a C script? 3 Answers
AI being scared of player. 0 Answers
Enemy AI using pathfinding to avoid obstacles 1 Answer
Why does my enemy teleport to my player? 2 Answers
Problems with Enemy AI with Raycasts 1 Answer