示例#1
0
        void MoveGPS()
        {
            posChange.x        = (float)MercatorProjection.lonToX(Input.location.lastData.longitude);
            posChange.z        = (float)MercatorProjection.latToY(Input.location.lastData.latitude);
            posMove            = posStart - posChange;
            transform.position = posMove;
            if (soundSource1Found)
            {
                UpdateDistances($"Distance to Source: {Vector3.Distance(posMove, soundSource1.position)}m");
            }
            else
            {
                UpdateDistances($"Sound Source Missing!");
                return;
            }


            if (Input.touchCount >= 2)
            {
                Vector2 touch0, touch1;
                float   distance;
                touch0   = Input.GetTouch(0).position;
                touch1   = Input.GetTouch(1).position;
                distance = Vector2.Distance(touch0, touch1);
                if (miniCamFound)
                {
                    miniCam.orthographicSize = orthoSize + distance;
                }
            }
        }
示例#2
0
        private IEnumerator setOffset()
        {
            yield return(new WaitForSeconds(3));

            offsetX = tS.GPSX;
            offsetZ = tS.GPSZ;
            ppX     = MercatorProjection.lonToX(offsetX - targetLocationLon);
            ppZ     = MercatorProjection.latToY(offsetZ - targetLocationLat);
            xT.text = ppX.ToString();
            yT.text = ppZ.ToString();
            engaged = true;
        }
示例#3
0
        void GetCanvas()
        {
            if (canvasmanager == null)
            {
                posStart.x = (float)MercatorProjection.lonToX(Input.location.lastData.longitude);
                posStart.z = (float)MercatorProjection.latToY(Input.location.lastData.latitude);

                var gm = GameObject.Find("LocationSeviceTest");
                if (gm != null)
                {
                    canvasmanager = gm.GetComponent <Canvasmanager>();
                    canvasmanager.m_LocationText.text = "Player Marker Added!";
                    canvasReady = true;
                }
                else
                {
                    Debug.Log("Error: No Canvas Manager!");
                }

                var mn = GameObject.Find("MiniCamera");
                if (mn != null)
                {
                    miniCam      = mn.GetComponent <Camera>();
                    miniCamFound = true;
                    StartCoroutine(DoCompassEn());
                }
                else
                {
                    Debug.Log("Error: No MiniCamera!");
                }

                var ss = GameObject.Find("sound source");
                if (ss != null)
                {
                    soundSource1      = ss.transform;
                    soundSource1Found = true;
                }
                else
                {
                    Debug.Log("Error: No sound source!");
                }
            }
        }
示例#4
0
        private void updatePos()
        {
            gpsX -= offsetX;
            gpsZ -= offsetZ;
            if (mercProjection)
            {
                x = MercatorProjection.lonToX(gpsX);
                z = MercatorProjection.latToY(gpsZ);
            }
            else
            {
                x = ConvertGPSCoords(gpsX);
                z = ConvertGPSCoords(gpsZ);
            }

            transform.position = new Vector3((float)x, 0, (float)z);
            float f = Vector2.Distance(new Vector2((float)x, (float)z), new Vector2(0, 30));

            oD.text = f.ToString();
        }
示例#5
0
 private void updateObjDistance()
 {
     ppX = MercatorProjection.lonToX(gpsX - targetLocationLon);
     ppZ = MercatorProjection.latToY(gpsZ - targetLocationLat);
 }