Есть скрипт слежения за Игроком вопрос в том как сделать так что бы он двигался за игроком только когда заходишь со стороны Enemy Camera:
Code
using UnityEngine;
using System.Collections;
public class AIMOB : 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 () {
Debug.DrawLine(target.position,
myTransform.position,
Color.yellow);
myTransform.rotation = Quaternion.Slerp(myTransform.rotation,
Quaternion.LookRotation(target.position - myTransform.position),
rotationSpeed*Time.deltaTime);
if(Vector3.Distance(target.position, myTransform.position) >= maxDistance){
myTransform.position += myTransform.forward * moveSpeed * Time.deltaTime;
}
}
}