// Start is called before the first frame update void Start() { mapmanager = GameObject.Find("Mapmanager"); mapcontroller temp = mapmanager.GetComponent <mapcontroller>(); rows = temp.Grows; clos = temp.Gclos; }
// Start is called before the first frame update void Start() { mapcontroller temp = GameObject.Find("Mapmanager").GetComponent <mapcontroller>(); rows = temp.Grows; clos = temp.Gclos; GameObject player = GameObject.Find("player"); Vector3 des = player.transform.position; velocity = (des - gameObject.transform.position) * speed / Vector3.Distance(des, gameObject.transform.position); }
void Start() { //得到速度向量 mapcontroller temp = GameObject.Find("Mapmanager").GetComponent <mapcontroller>(); rows = temp.Grows; clos = temp.Gclos; Vector3 des = new Vector3(clos, rows, 0); des = des - gameObject.transform.position; velocity = (des - gameObject.transform.position) * speed / Vector3.Distance(des, gameObject.transform.position); Enamybulltes = GameObject.Find("Mapmanager").GetComponent <mapcontroller>().Enamybulltes; }