public static string Check(Vector3 p) { string names = ""; for (int i = 0; i < items.Length; i++) { rootPlace element = items[i]; float x, y, z; x = float.Parse(element.xcordinate); y = float.Parse(element.ycordinate); z = float.Parse(element.zcordinate); Vector3 build = new Vector3(x, y, z); if (((Vector3.Distance(build, p)) < 20)) { names = element.placeName; } } return(names); }
private void windowFunc(int id) { department = GUILayout.TextField(department, 25); if (GUILayout.Button(slectedItem)) { editing = true; if (btnPress) { editing = false; btnPress = false; } else { btnPress = true; } } if (editing) { scrollPosition = GUILayout.BeginScrollView(scrollPosition, GUILayout.Width(Box.width), GUILayout.Height(80)); for (int x = 0; x < items.Length; x++) { if ((department.Equals("")) || (department.Equals(initialText))) { if (GUILayout.Button(items[x].placeName)) { slectedItem = items[x].placeName; editing = false; } } else { rootPlaceDepartmentListDepartment[] deptList = items[x].departmentList; if (deptList != null) { for (int y = 0; y < deptList.Length; y++) { if (deptList[y].Value.ToLower().Contains(department.ToLower())) { if (GUILayout.Button(items[x].placeName)) { slectedItem = items[x].placeName; editing = false; } } } } } } GUILayout.EndScrollView(); } GUILayout.BeginHorizontal(); if (GUILayout.Button("Ok")) { department = initialText; clickAndDrag.isenabled = true; for (int i = 0; i < items.Length; i++) { rootPlace element = items[i]; if (element.placeName.Equals(slectedItem)) { Debug.Log("location = " + element.xcordinate + "," + element.ycordinate + "," + element.zcordinate); float x, y, z; x = float.Parse(element.xcordinate); y = float.Parse(element.ycordinate); z = float.Parse(element.zcordinate); Follow.updateLocation(new Vector3(x, y, z), element.placeDesc, slectedItem); } } paused = false; slectedItem = oldslectedItem; editing = false; } if (GUILayout.Button("Canel")) { department = initialText; slectedItem = oldslectedItem; editing = false; clickAndDrag.isenabled = true; paused = false; } if (GUILayout.Button("Quit")) { department = initialText; clickAndDrag.isenabled = true; editing = false; Application.Quit(); } GUILayout.EndHorizontal(); }