void LookAt() { if (obj == null) { return; } if (obj.gameObject.activeSelf) { GameObject camObj = GameObject.Find("Main Camera") as GameObject; CameraMovement cameraCont = camObj.GetComponent <CameraMovement> (); if (type == 1) { pointCloud cloudObj = obj.GetComponent <pointCloud> (); cameraCont.CloseWatch(cloudObj.GetCenterPos()); } if (type == 2) { KFListObj kfObj = obj.GetComponent <KFListObj> (); cameraCont.CloseWatch(kfObj.GetCenterPos()); } if (type == 3) { RoadMesh raodobj = obj.GetComponent <RoadMesh> (); cameraCont.CloseWatch(raodobj.lookAtPoint); } } }
public static CarC create(List <KeyFrameC> carKFLists, List <KeyFrameC> sCarKFLists, List <mapPoint> carMPLists, List <mapPoint> sCarMPLists) { if (carItemUIFab == null) { carItemUIFab = Resources.Load("carItemUI") as GameObject; carListUI = GameObject.Find("Canvas/Panel/CarList/ScrollView/List"); carList = new List <CarC>(); GameObject obj = GameObject.Find("Main Camera") as GameObject; cameraCont = obj.GetComponents <CameraMovement> () [0]; } if (carKFLists.Count > 0) { GameObject clone = Object.Instantiate(carItemUIFab, Vector3.zero, Quaternion.identity ) as GameObject; clone.transform.Find("Text").GetComponents <Text> () [0].text = "Car " + curCarId; CarC itemCar = new CarC(); clone.GetComponents <Button> () [0].onClick.AddListener( () => itemCar.onClickCarUI()); itemCar.btn = clone.transform; itemCar.id = curCarId; curCarId = curCarId + 1; clone.transform.SetParent(carListUI.transform); KFListObj carKF = KFListObj.create(carKFLists, 0); itemCar.keyFrameObj = carKF; carList.Add(itemCar); return(itemCar); } return(null); }
public static KFListObj create(List <KeyFrameC> kFList, int _listId) { if (rootObj == null) { rootObj = new GameObject().transform; rootObj.name = "KFRoot"; } GameObject obj = new GameObject(); obj.transform.SetParent(rootObj); obj.name = "KFList"; KFListObj kfListObj = obj.AddComponent <KFListObj> (); kfListObj.KFList = kFList; kfListObj.listId = _listId; return(kfListObj); }
public void ShowObj(bool val, int scale = 100) { if (menuObj == null && val == true) { initMenu(); } if (obj == null && val == true) { if (type == 1) { obj = pointCloud.create(CppInterface.GetMPList(id)); } if (type == 2) { obj = KFListObj.create(CppInterface.GetKFList(id), ListId).transform; } if (type == 3) { RdSegData = CppInterface.GetRSList(id); if (showCount > RdSegData.Count || showCount <= 0) { showCount = RdSegData.Count; } obj = RoadMesh.create(RdSegData.GetRange(0, showCount)).transform; } if (type == 5) { ChannelInfo img = ChannelInfo.getChannel(5, id); ChannelInfo feature = ChannelInfo.getChannel(4, id); if (img != null) { commonObj.mMainUI.updateFrameDisplay(img, feature); } } if (type == 6) { List <TraficSign> tmp = CppInterface.GetTSList(id); if (showCount >= 0 && showCount < tmp.Count) { tmp.RemoveRange(showCount, tmp.Count - showCount); } obj = TraficSignMesh.create(tmp).transform; } if (type == 7) { List <ActMapPoint> tmp = CppInterface.GetAMPList(id); obj = ActMPMesh.create(tmp); } } if (obj != null) { obj.gameObject.SetActive(val); if (val) { transform.Find("Text").GetComponent <Text> ().color = getColorFromUI(); } else { transform.Find("Text").GetComponent <Text> ().color = new Color32(0, 0, 0, 255); } } }