I want the enemy to idle , follow , and attack the player . The thing is I want the enemy to use it's move animation when following the player , and use the attack animation when the player is in distance , and ldle back when the player is dead . I am having some problems. Here is my java script :
var other : Transform;
function Start () {
}
function Update () {
var distance = Vector3.Distance(transform.position, other.transform.position);
GetComponent.Animation.Play("attack");
}
↧