Hi,
I am trying to make an AI follow the player and shoot at them at intervals.
At present I cannot think of the appropriate way of writing a delay between calling the function.
IEnumerator followThePlayer () {
transform.position = Vector3.MoveTowards (transform.position, new Vector3(transform.position.x, player.position.y, transform.position.z), 1f * Time.deltaTime);
yield return new WaitForSeconds(5);
shootThePlayer ();
Would setting a boolean called isActive on or off a good way of delaying the attack being called in your opinion?
Thanks.