Hi, i am making a game called KillerSquare Tm I have a enemy AI script where the enemy follows the Char_Controller and i want a script that when a enemy(Square) Touches my Char_Controller make the char_Controller get destroyed. all help would be appreciated.
thanks in advance, orangec0w
oh heres the AI script
using UnityEngine;
using System.Collections;
public class EnemyAI : 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.position, myTransform.position, Color.yellow);
//Look at target
myTransform.rotation = Quaternion.Slerp(myTransform.rotation, Quaternion.LookRotation(target.position - myTransform.position), rotationSpeed * Time.deltaTime);
//Move toward target
myTransform.position += myTransform.forward * moveSpeed * Time.deltaTime;
}
}