using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class TestPhoneTrigger : MonoBehaviour { public Transform player; public Text text; /// /// 所有触发器 /// public List list_box; /// /// 对应触发器显示的效果 /// public List list_Effects; /// /// 水晶点 /// public List list_points; /// /// 显示路径的触发器 /// public List list_RouteBox; public ShowRoute showRoute; public Transform mapPlayer; public TeshMap teshMap; public TestP6Car testP6Car; public GameObject other; // public LineMap linMap; void Start() { // text.text = "Test"; // linMap.CreateLineMap(); } private void LateUpdate() { //if (API_SVR.GetHead() != null && transform.position != API_SVR.GetHead().transform.position) //{ // transform.position = API_SVR.GetHead().transform.position; // mapPlayer.position = transform.position; // mapPlayer.eulerAngles = API_SVR.GetHead().transform.eulerAngles; // //transform.eulerAngles = API_SVR.GetHead().transform.eulerAngles; //} if (player != null && transform.position != player.position) { transform.position = player.position; mapPlayer.position = transform.position; mapPlayer.eulerAngles = player.eulerAngles; //transform.eulerAngles = API_SVR.GetHead().transform.eulerAngles; } } private void OnTriggerEnter(Collider other) { // text.text = "Enter " + other.name; Debug.Log(other.name); QueryBox(other, true); } private void OnTriggerExit(Collider other) { QueryBox(other, false); } /// /// 查找触发器 /// /// /// private void QueryBox( Collider other , bool state) { for (int i = 0; i < list_RouteBox.Count; i++) { if(list_RouteBox[i].name == other.name) { if (state) this.other = other.gameObject; else this.other = null; showRoute.SettingRoute(i + 1, state); } } for (int i = 0; i < list_box.Count; i++) { if (other.name == list_box[i].name) { // 擎天柱大模型关闭 //if (!state && i /// 设置显示效果(触发器判定选择) /// private void SetShowObject(GameObject Obj , GameObject Effect , bool state) { Effect.SetActive(state); Obj.SetActive(!state); } private void SetShowObject( GameObject Effect, bool state) { Effect.SetActive(state); } }