public void Hit(Vector3 position) { Camera ca = Camera.main; Ray ray = ca.ScreenPointToRay(position); RaycastHit[] hits; hits = Physics.RaycastAll(ray); for (int i = 0; i < hits.Length; i++) { RaycastHit hit = hits[i]; if (hit.collider.gameObject.GetComponent <DiskData>() != null) { //将飞碟移至底端,触发飞行动作的回调 hit.collider.gameObject.transform.position = new Vector3(0, -7, 0); //积分 roundController.Record(hit.collider.gameObject.GetComponent <DiskData>()); //更新GUI数据 userGUI.SetPoints(roundController.GetPoints()); } } }