public MapARLayerDup getDuplication() { if (this.mapARLayerDup == null) { this.mapARLayerDup = new MapARLayerDup(this); } return(this.mapARLayerDup); }
public void cancelHighLightDup() { if (layer != null && !_oldVersion) { MapARLayerDup layerdup = layer.getDuplication(); layerdup.cancelHighLight(); } }
private void initMetaphorObject() { if (layer == null) { return; } GameObject cube = GameObject.CreatePrimitive(PrimitiveType.Cube); cube.name = layer.getLayerName().ToUpper(); cube.transform.localScale = 0.1f * localScaleOrg; cube.GetComponent <MeshRenderer>().enabled = true; //GameObject.Destroy(Cube.GetComponent<Collider>()); //MeshCollider mc = Cube.AddComponent<MeshCollider>(); //mc.convex = true; BoxCollider bc = cube.GetComponent <BoxCollider>(); bc.center = new Vector3(0.5f, 0f, 0f); bc.size = new Vector3(2.0f, 1f, 1f); Material newMaterial = (Material)Resources.Load("LayerMetaphorDefault", typeof(Material)); cube.GetComponent <Renderer>().material = newMaterial; goText = new GameObject("Text_" + layer.getLayerName()); TextMesh tm = goText.AddComponent <TextMesh>(); tm.text = layer.getLayerName(); tm.characterSize = 2; goText.transform.parent = cube.transform; goText.transform.localPosition = new Vector3(.6f, 0f, 0f); goText.transform.localScale = new Vector3(.1f, .8f, .1f); if (!_oldVersion) { cube.GetComponent <MeshRenderer>().enabled = false; MapARLayerDup layerDup = layer.getDuplication(); layerDup.setDupObjParent(cube.transform); layerDup.hideText(); } Rigidbody rb = cube.AddComponent <Rigidbody>(); rb.useGravity = false; rb.isKinematic = true; cube.AddComponent <LockRotation>(); //InteractionBehaviour ib = cylinder.AddComponent<InteractionBehaviour>(); //System.Action a = () => highLightDup(); //ib.OnGraspBegin = a; //a = () => cancelHighLightDup(); //ib.OnGraspEnd = a; worldObject = cube; interactionBehaviour = worldObject.AddComponent <InteractionBehaviour>();// (standard_ib); interactionBehaviour.moveObjectWhenGrasped = false; //worldObject.transform.Rotate(Vector3.up, 120); }
public void updateLayer(List <UnwrappedTileId> tileIDs) { updateLayerGameObjects(); updateLayerBasement(tileIDs); if (this.mapARLayerDup != null) { this.mapARLayerDup.destory(); this.mapARLayerDup = new MapARLayerDup(this); } }
protected void updateLayerBasement(List <UnwrappedTileId> tileIDs) { foreach (UnwrappedTileId id in tileIDs) { basementGameObjects.Add(GameObject.Find(id.ToString())); } if (mapARLayerDup != null) { mapARLayerDup.destory(); mapARLayerDup = new MapARLayerDup(this); } }
public void update(List <UnwrappedTileId> tileIds) { layer.updateLayer(tileIds); if (!_oldVersion) { MapARLayerDup layerDup = layer.getDuplication(); layerDup.hideText(); layerDup.setDupObjParent(this.worldObject.transform); layerDup.resetLocalScaleBy(reScaleRate); //layerDup.resetLocalPos(new Vector3(0, 0, 0)); layerDup.resetLocalPos(new UnityEngine.Pose()); } }
protected IEnumerator DuplicationMovement(MapARLayerDup targetLayer, Vector3 movementDirection, float movementDistance, float movementTime, int mode) { //this.Lock = true; for (float t = 0.0f; t < movementTime;) { float td = Time.deltaTime; //targetLayer.moveUp(movementDistance * Time.deltaTime / movementTime); targetLayer.moveTowards(movementDirection, movementDistance * Time.deltaTime / movementTime); t += td; yield return(null); } if (mode == 2) { targetLayer.destory(); } //this.Lock = false; }
protected void AddLayer(MapARLayer layer) { MapARLayerDup mapARLayerDup = layer.getDuplication(); mapARLayerDup.show(); mapARLayersActived.Insert(0, layer); mapARLayersDisActived.Remove(layer); StartCoroutine(DuplicationMovement(mapARLayerDup, Vector3.up, dupGap * 5, dupMovementTime, 1)); mapARLayersActivedDup.Insert(currentSelectedIndex, mapARLayerDup); foreach (MapARLayerDup layerDup in mapARLayersActivedDup) { if (mapARLayersActivedDup.IndexOf(layerDup) > currentSelectedIndex) { StartCoroutine(DuplicationMovement(layerDup, Vector3.up, dupGap, dupMovementTime, 1)); } } MapHightLightUpdate(); }
protected void DeleteLayer(MapARLayer layer) { MapARLayerDup mapARLayerDup = layer.getDuplication(); mapARLayersActived.Remove(layer); mapARLayersDisActived.Insert(0, layer); StartCoroutine(DuplicationMovement(mapARLayerDup, Vector3.down, dupGap * 5, dupMovementTime, 1)); mapARLayersActivedDup.Remove(mapARLayerDup); //mapARLayerDup.destory(); foreach (MapARLayerDup layerDup in mapARLayersActivedDup) { if (mapARLayersActivedDup.IndexOf(layerDup) >= currentSelectedIndex) { StartCoroutine(DuplicationMovement(layerDup, Vector3.down, dupGap, dupMovementTime, 1)); } } mapARLayerDup.hide(); MapHightLightUpdate(); }
public void removeDuplication() { this.mapARLayerDup = null; }
public void createSelections(string selectionStr) { removeSelections(); List <string> attributes = new List <string>(); if (selectionStr == "COLOR") { attributes.Add("Red"); attributes.Add("Yellow"); attributes.Add("Blue"); } else if (selectionStr == "TRANSPARENCY") { attributes.Add("25"); attributes.Add("50"); attributes.Add("75"); attributes.Add("100"); } else if (_oldVersion) { if (selectionStr == "RED") { layer.setColor(Color.red); } else if (selectionStr == "YELLOW") { layer.setColor(Color.yellow); } else if (selectionStr == "BLUE") { layer.setColor(Color.blue); } else if (selectionStr == "25") { layer.setTransparency(25); } else if (selectionStr == "25") { layer.setTransparency(25); } else if (selectionStr == "50") { layer.setTransparency(50); } else if (selectionStr == "100") { layer.setTransparency(100); } endSelectState(); unselectActions(); LayerManager.goSelected = null; } else { MapARLayerDup layerdup = layer.getDuplication(); if (selectionStr == "RED") { layerdup.setColor(Color.red); } else if (selectionStr == "YELLOW") { layerdup.setColor(Color.yellow); } else if (selectionStr == "BLUE") { layerdup.setColor(Color.blue); } else if (selectionStr == "25") { layerdup.setTransparency(25); } else if (selectionStr == "25") { layerdup.setTransparency(25); } else if (selectionStr == "50") { layerdup.setTransparency(50); } else if (selectionStr == "100") { layerdup.setTransparency(100); } endSelectState(); unselectActions(); LayerManager.goSelected = null; } int count = 0; foreach (string attStr in attributes) { SelectionMetaphor sm = new SelectionMetaphor(this, -0.7f, attStr); //sm.rotateBy(30 * count); sm.pushTo(-0.7f - 0.4f * count); selectionObjects.Add(sm); count++; } }