can some one please help me translate this script that my teacher wrote into java??? …its in c#…but Im not custom too all the functions of C# so can some one please help me?
the script:
using UnityEngine;
using System.Collections;
public class EnemyAI : MonoBehaviour {
public Transform target;
public int moveSpeed;
public int rotationSpeed;
public int maxDistance;
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 () {
float distance = Vector3.Distance(target.transform.position, transform.position);
myTransform.rotation = Quaternion.Slerp(myTransform.rotation, Quaternion.LookRotation(target.position - myTransform.position),rotationSpeed * Time.deltaTime);
if(distance < 20f && Vector3.Distance(target.position, myTransform.position) > maxDistance)
{
Debug.DrawLine(target.position, myTransform.position, Color.blue);
animation.Play("run");
myTransform.position += myTransform.forward * moveSpeed * Time.deltaTime;
}
else
{
animation.CrossFade("idle",1.0f);
}
}
}