Пример #1
0
 void Start()
 {
     CoordConversion.resetOrigin(152.7106403f, -24.1131252f);         // these values will come from the lobby mesh selection
     canShowMap = true;
     mapType    = MapType.Satellite;
     gameObject.GetComponent <Renderer> ().enabled = false;
     initMarkers();
     addMarker(CoordConversion.oLat, CoordConversion.oLon, 0);         // Automatically add player marker
     updatePlayer(GameObject.Find("GetPlayerPos").transform.position.x, GameObject.Find("GetPlayerPos").transform.position.z);
     if (loadOnStart)
     {
         StartCoroutine(_Refresh());
     }
     StartCoroutine(refreshMapOnTimer());
     isChecked = false;
 }
Пример #2
0
    // Loads the mesh "reefSection".ply at the coordinate position desiganted in the txt file "reefSection".txt
    // which are saved on the localhost at "http://localhost/ReefMeshes/"
    public IEnumerator loadMesh(string reefSection)
    {
        string url       = "http://localhost/ReefMeshes/" + reefSection;
        string path      = @"C:\ReefData\" + reefSection;
        WWW    wwwScript = new WWW(url + ".ply");
        WWW    wwwMeta   = new WWW(url + ".txt"); // real server stuff

        yield return(wwwScript);

        yield return(wwwMeta);


        File.WriteAllBytes(path + ".ply", wwwScript.bytes);

        string[] coords = wwwMeta.text.ToString().Split(',');

        float xPos = CoordConversion.calcX(float.Parse(coords[1]));
        float zPos = CoordConversion.calcZ(float.Parse(coords[0]));

        CoordConversion.resetOrigin(xPos, zPos);          // resets origin and puts mesh in origin position- easily changed
        GetComponent <PLYImporter>().ReadBinaryFile(path + ".ply", 0, 0f, 0);
    }