// Update is called once per frame void Update() { if (EventSystem.current.IsPointerOverGameObject()) { return; } if (isSelectingMapFeature && !isAddingFeature && Input.GetMouseButtonDown(0)) { Vector3 clickPos = Input.mousePosition; Ray ray = Camera.main.ScreenPointToRay(clickPos); RaycastHit hit; if (Physics.Raycast(ray, out hit, 1000.0f)) { CustomFeatureBehaviour feature = hit.collider.gameObject.GetComponentInParent <CustomFeatureBehaviour>(); if (feature != null) { string name = feature.Data.Properties["name"].ToString(); Vector2d latlong = map.WorldToGeoPosition(hit.point); selectCallback(name, latlong.ToString()); Debug.Log("Latlong " + latlong); Debug.Log(name); ResetState(); } } } }
void ApplyFilter(CustomFeatureBehaviour feature) { //if (!feature.VectorEntity.Feature.Properties["name"].ToString().ToLower().Contains(searchFilter.ToLower())) //{ // feature.gameObject.SetActive(false); //} //else //{ // feature.gameObject.SetActive(true); //} }
public override void Run(VectorEntity ve, UnityTile tile) { Vector3 posOffset = new Vector3(0, prefab.GetComponent <BoxCollider>().size.y, 0); posOffset.Scale(prefab.transform.localScale * .5f); ve.GameObject.transform.position = ve.GameObject.transform.position + posOffset; if (_features.ContainsKey(ve.GameObject)) { _features[ve.GameObject].Initialize(ve); ApplyFilter(_features[ve.GameObject]); } else { _tempFeature = ve.GameObject.AddComponent <CustomFeatureBehaviour>(); _features.Add(ve.GameObject, _tempFeature); _tempFeature.Initialize(ve); ApplyFilter(_tempFeature); featureList.Add(_tempFeature); } }