Enemy AI

i try to build and AI for my Game i follow the tutorial BurZerg Arcade and work Kind a the problem with the AI

the enemy cross over all the objects what mean if my Player hide behind a Wall the enemy cross over how i can make him to no go trough the Walls or objects.

this is the Code :

using UnityEngine;
using System.Collections;

public class enemy: MonoBehaviour {
public Transform target;
public int moveSpeed;
public int rotationSpeed;
private Transform myTransform;

void Awake (){
myTransform = transform;
}

// Use this for initialization
void Start () {
GameObject go = GameObject.FindGameObjectWithTag(“Player”);
target = go.transform;

}
// Update is called once per frame
void Update () {
Debug.DrawLine(target.transform.position, myTransform.position,Color.red);

//Look at Target
myTransform.rotation = Quaternion.Slerp(myTransform.rotation, Quaternion.LookRotation(target.position - myTransform.position), rotationSpeed * Time.deltaTime);

// Move Towards target
myTransform.position += myTransform.forward * moveSpeed * Time.deltaTime;

}
}

I believe it’s going to take a bit more code to achieve a decent working solution XD…

you may want first add some collider / trigger on your object environment, then maybe try with some simple avoidance code to make your enemy not cross your wall at first, there is plenty of example of that on the net I am sure, and using simple shape trigger it work generally not bad depending on your environment.
Or dive into pathfinding , there is a nice plugin for that for unity if I remember.

HI is me again i been trying to modify the script and looking in the INTERNET without any luck can somebody can give and example
THANKS

Wel I been working on the AI and getting almost there I will have screenshots the soon is possible

i having a problem the AI works well but how i came make to play the animations

this is the code :

//////////////variables used///////////////
var waypoint : Transform[ ];
var speed : float = 20;
private var currentWaypoint: int;
var loop : boolean = true;
var player : Transform;
var bullet: Transform;
animation.wrapMode = WrapMode.Loop;
///////////////////////////////////////

function Awake(){
waypoint[0] = transform;
}
function Update () {
if(currentWaypoint<waypoint.length){
var target : Vector3 = waypoint[currentWaypoint].position;
var moveDirection : Vector3 = target-transform.position;
var distFromPlayer : Vector3 = player.position-transform.position;
animation.CrossFade (“walk”);

var velocity = rigidbody.velocity;
if(moveDirection.magnitude<1){
currentWaypoint++;
}
else if(distFromPlayer.magnitude<10){
Shoot();
velocity = Vector3.zero;
target=player.position;
velocity = (player.position - transform.position).normalized*speed;
}
else{
velocity = moveDirection.normalized * speed;
}
}
else{
if(loop){
currentWaypoint=0;
}
}

rigidbody.velocity = velocity;
}

function Shoot(){
var bullet = Instantiate(bullet,GameObject.Find(“shootpistion”).transform.position, Quaternion.identity);
animation.CrossFade (“run”);

bullet.rigidbody.AddForce(transform.forward * 3000 );

}

any suggestions ?

This the enemy setup
please what I am doing Wrong ?

well I already figure out the problem anyways one more thing for the record

I LOVE THIS ENGINE my animations are already working.

What is this BurZerg Arcade? What tutorial is trhis from?