Example #1
0
    protected void MapLayerInit()
    {
        foreach (GameObject gameObj in GameObject.FindObjectsOfType <GameObject>())
        {
            if (gameObj.name == "Map")
            {
                mapObj = gameObj;
            }
        }

        if (mapObj != null)
        {
            mapToEdit = mapObj.GetComponent <AbstractMap>();
            List <VectorSubLayerProperties> mapLayerProperties = (List <VectorSubLayerProperties>)mapToEdit.VectorData.GetAllFeatureSubLayers();
            foreach (VectorSubLayerProperties vsp in mapLayerProperties)
            {
                MapARLayer newLayer = new MapARLayer(vsp);
                if (vsp.coreOptions.isActive)
                {
                    mapARLayersActived.Add(newLayer);
                }
            }
            if (mapARLayersActived.Count != 0)
            {
                layerLabel.GetComponent <TextMesh>().text = ("Current Layer: " + mapARLayersActived[currentSelectedIndex].getLayerName());
            }
            else
            {
                layerLabel.GetComponent <TextMesh>().text = ("No Actived Layer found.");
            }
        }
    }
Example #2
0
    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();
    }
Example #3
0
    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 MapARLayerDup(MapARLayer originalLayer)
    {
        this.originalLayer = originalLayer;
        this.allRelatedObj = new GameObject();
        GameObject        layerGameObjectsDup    = new GameObject();
        List <GameObject> basementGameObjectsDup = new List <GameObject>();

        layerGameObjectsDup = UnityEngine.Object.Instantiate(originalLayer.getLayerGameObject(), originalLayer.getLayerGameObject().transform);
        layerGameObjectsDup.transform.parent = this.allRelatedObj.transform;
        Material newmaterial = new Material(Shader.Find("Transparent/Diffuse"));

        newmaterial.color = new Color(1f, 1f, 1f, TranRateOg);
        Vector3 baseCenterSum = new Vector3();

        foreach (GameObject gameObj in originalLayer.getBaseMentGameObject())
        {
            GameObject newGameObj = GameObject.CreatePrimitive(PrimitiveType.Cube);
            newGameObj.transform.parent     = gameObj.transform.parent;
            newGameObj.transform.position   = gameObj.transform.position;
            newGameObj.transform.localScale = gameObj.transform.localScale;
            baseCenterSum += newGameObj.GetComponent <Renderer>().bounds.center;
            newGameObj.GetComponent <Renderer>().material = newmaterial;
            GameObject.Destroy(newGameObj.GetComponent <BoxCollider>());
            MeshFilter mf = newGameObj.GetComponent <MeshFilter>();
            mf.mesh = gameObj.GetComponent <MeshFilter>().mesh;
            newGameObj.transform.parent = this.allRelatedObj.transform;
            basementGameObjectsDup.Add(newGameObj);
        }
        this.renderCenter = baseCenterSum / originalLayer.getBaseMentGameObject().Count;
        this.setLayerGameObject(layerGameObjectsDup);
        this.setBasementGameObject(basementGameObjectsDup);

        this.nameText = new GameObject("DupName_" + originalLayer.getLayerName());
        TextMesh tm = nameText.AddComponent <TextMesh>();

        tm.text = originalLayer.getLayerName();
        tm.transform.Translate(1, 0, -1);
        tm.transform.localScale        = new Vector3(.1f, .1f, .1f);
        this.nameText.transform.parent = allRelatedObj.transform;
        //this.allRelatedObj.AddComponent<MeshRenderer>();
        //Rigidbody rig = this.allRelatedObj.AddComponent<Rigidbody>();
        //rig.useGravity = false;
    }
 public LayerMetaphor(MapARLayer layer, GameObject metaphorObject)
 {
     this.layer       = layer;
     this.worldObject = metaphorObject;
 }
 public LayerMetaphor(MapARLayer layer, bool oldVersion)
 {
     this.layer  = layer;
     _oldVersion = oldVersion;
     initMetaphorObject();
 }
 public LayerMetaphor(MapARLayer layer)
 {
     this.layer = layer;
     initMetaphorObject();
 }