Exemple #1
0
    private void Start()
    {
        string RecLocation = PlayerPrefs.GetString("CAFE");

        List <Location> locations = new List <Location>();
        string          word      = "|";

        string[] words = RecLocation.Split(new string[] { word }, StringSplitOptions.None);
        int      cnt   = words.Length - 1;

        string[] val = RecLocation.Split('|');
        string[] val2;

        manager = ARLocationManager.Instance;

        if (manager == null)
        {
            Debug.LogError("[ARFoundation+GPSLocation][PlaceAtLocations]: ARLocatedObjectsManager Component not found.");
            return;
        }

        for (int i = 0; i < cnt; i++)
        {
            val2 = val[i].Split(',');
            Location location1 = new Location();
            location1.label     = val2[0];
            location1.longitude = Convert.ToDouble(val2[1]);
            location1.latitude  = Convert.ToDouble(val2[2]);
            location1.altitude  = -1.5;
            locations.Add(location1);
        }

        locations.ForEach(AddLocation);
    }
Exemple #2
0
    private void Start()
    {
        manager = ARLocationManager.Instance;

        points = new Vector3[path.locations.Length];

        for (var i = 0; i < points.Length; i++)
        {
            points[i] = path.locations[i].ToVector3();
        }

        spline = Utils.BuildSpline(path.splineType, points, splineSampleSize, path.alpha);

        var sample = spline.SamplePoints(objectCount);

        entries = new ARLocationManagerEntry[sample.Length];

        for (var i = 0; i < entries.Length; i++)
        {
            entries[i] = new ARLocationManagerEntry
            {
                instance = prefab,
                location = new Location(sample[i].z, sample[i].x, sample[i].y),
                options  = new ARLocationObjectOptions
                {
                    isHeightRelative        = isHeightRelative,
                    movementSmoothingFactor = movementSmoothingFactor,
                    showDebugInfoPanel      = showDebugInfoPanel,
                    createInstance          = true
                }
            };

            manager.Add(entries[i]);
        }
    }
        // Start is called before the first frame update
        void Start()
        {
            mainCamera           = ARLocationManager.Instance.MainCamera;
            lineRenderer         = GetComponent <LineRenderer>();
            arLocationManager    = ARLocationManager.Instance;
            hasArLocationManager = arLocationManager != null;

            if (!lineRenderer)
            {
                lineRenderer = gameObject.AddComponent <LineRenderer>();

                var shader = Shader.Find("Unlit/Color");
                if (shader)
                {
                    lineRenderer.material = new Material(shader)
                    {
                        color = new Color(0.3960f, 0.6901f, 0.9725f)
                    };
                }
            }

            lineRenderer.useWorldSpace             = true;
            lineRenderer.alignment                 = LineAlignment.View;
            lineRenderer.receiveShadows            = false;
            lineRenderer.shadowCastingMode         = ShadowCastingMode.Off;
            lineRenderer.allowOcclusionWhenDynamic = false;
            lineRenderer.positionCount             = 2;
            lineRenderer.startWidth                = 0.1f;
            lineRenderer.endWidth = 0.1f;

            textMeshGo = new GameObject(gameObject.name + "_text");
            textMeshGo.transform.localScale = new Vector3(0.05f, 0.05f, 0.05f);
            textMesh          = textMeshGo.AddComponent <TextMesh>();
            textMesh.fontSize = 100;
        }
Exemple #4
0
    // Use this for initialization
    void Start()
    {
        Location currentLoc = new Location();

        currentLoc.longitude = Convert.ToDouble(Input.location.lastData.longitude);
        currentLoc.latitude  = Convert.ToDouble(Input.location.lastData.latitude);
        currentLoc.altitude  = 0;

        manager = ARLocationManager.Instance;

        entry = new ARLocationManagerEntry
        {
            instance = gameObject,
            location = currentLoc,
            options  = new ARLocationObjectOptions
            {
                isHeightRelative        = isHeightRelative,
                showDebugInfoPanel      = showDebugInfoPanel,
                movementSmoothingFactor = movementSmoothingFactor,
                createInstance          = false
            }
        };

        manager.Add(entry);
    }
 // Start is called before the first frame update
 void Start()
 {
     locationProvider    = ARLocationProvider.Instance;
     arLocationManager   = ARLocationManager.Instance;
     arLocationRoot      = arLocationManager.gameObject.transform;
     mainCameraTransform = arLocationManager.MainCamera.transform;
     locationProvider.OnLocationUpdatedEvent(locationUpdatedHandler);
     locationProvider.OnProviderRestartEvent(ProviderRestarted);
 }
Exemple #6
0
        IEnumerator Start()
        {
            yield return(new WaitForSeconds(0.5f));

            manager = ARLocationManager.Instance;

            if (manager == null)
            {
                Debug.LogError("[ARFoundation+GPSLocation][PlaceAtLocations]: ARLocatedObjectsManager Component not found.");
            }


            locations.ForEach(AddLocation);
        }
Exemple #7
0
    private void Awake()
    {
        // Make sure our delegate is registered beforehand
        manager = ARLocationManager.Instance;
        manager.OnObjectAdded(HandleOnObjectAddedDelegate);

        if (canvas == null)
        {
            var newCanvas = GameObject.Find("ARLocationInfo/ObjectInfoCanvas");

            if (newCanvas != null)
            {
                canvas = newCanvas.GetComponent <Canvas>();
            }
        }
    }
Exemple #8
0
    // Use this for initialization
    void Start()
    {
        manager = ARLocationManager.Instance;
        // CreateTextObjects();

        AddLocationsPOIs();

        if (openStreetMapOptions.FetchFromOverpassApi && openStreetMapOptions.overPassRequestData != null)
        {
            StartCoroutine("LoadXMLFileFromOverpassRequest");
        }
        else if (openStreetMapOptions.OsmXmlFile != null)
        {
            LoadXMLFileFromTextAsset();
        }
    }
Exemple #9
0
        // Use this for initialization
        public void Awake()
        {
            GetUid(); // 현재 유저의 Uid를 가져온 후 저장

            PopupMessage = GameObject.Find("PopupMessage");
            LoadingPopup = GameObject.Find("LoadingPopup");
            manager      = ARLocationManager.Instance;
            PopupMessage.SetActive(false);



            gps = GameObject.Find("GpsMachine").GetComponent <UsingGps>();

            firebaseApp = FirebaseDatabase.DefaultInstance.App;
            FirebaseApp.DefaultInstance.SetEditorDatabaseUrl("https://littletigers-44351.firebaseio.com");
            databaseReference = FirebaseDatabase.DefaultInstance.RootReference;

            FirebaseDatabase.DefaultInstance.GetReference("ARMessages").GetValueAsync().ContinueWith(task =>
            {
                if (task.IsFaulted)
                {
                    Debug.Log("Database Error");
                }
                else if (task.IsCompleted)
                {
                    DataSnapshot snapshot = task.Result;
                    foreach (var item in snapshot.Children)
                    {
                        Location location       = new Location();
                        location.key            = Convert.ToString(item.Child("key").Value);
                        location.altitude       = Convert.ToDouble(item.Child("altitude").Value);
                        location.ignoreAltitude = Convert.ToBoolean(item.Child("ignoreAltitude").Value);
                        location.label          = Convert.ToString(item.Child("label").Value);
                        location.latitude       = Convert.ToDouble(item.Child("latitude").Value);
                        location.longitude      = Convert.ToDouble(item.Child("longitude").Value);
                        location.uid            = Convert.ToString(item.Child("uid").Value);
                        location.likecnt        = Convert.ToInt32(item.Child("likecnt").Value);
                        foreach (var clickuid in item.Child("likelist").Children)
                        {
                            location.likelist.Add(Convert.ToString(clickuid.Value));
                        }
                        locations.Add(location);
                        AddLocation(location);
                    }
                }
            });
        }
    public void Start()
    {
        locationProvider    = ARLocationProvider.Instance;
        arLocationManager   = ARLocationManager.Instance;
        arLocationRoot      = arLocationManager.gameObject.transform;
        mainCameraTransform = arLocationManager.MainCamera.transform;
        locationProvider.OnLocationUpdatedEvent(locationUpdatedHandler);
        locationProvider.OnProviderRestartEvent(ProviderRestarted);
        csv          = GetComponent <CSV>();
        delaunayMesh = GetComponent <DelaunayMesh>();

        if (locationProvider == null)
        {
            Debug.LogError("[AR+GPS][PlaceAtLocation]: LocationProvider GameObject or Component not found.");
            return;
        }
    }
Exemple #11
0
    void Start()
    {
        if (locationPath == null)
        {
            throw new Exception("null location path");
        }

        pointCount = locationPath.locations.Length;
        points     = new Vector3[pointCount];

        locationProvider = ARLocationProvider.Instance;
        locationProvider.OnLocationUpdated(LocationUpdated);

        manager = ARLocationManager.Instance;
        manager.OnRestart(OnRestartHandler);

        arLocationRoot = Utils.FindAndLogError("ARLocationRoot", "[ARLocationMoveAlongPath]: ARLocationRoot GameObject not found.");

        // Check if we use smooth movement
        if (movementSmoothingFactor > 0)
        {
            gameObject.AddComponent <SmoothMove>();
            GetComponent <SmoothMove>().smoothing = movementSmoothingFactor;
        }

        transform.SetParent(arLocationRoot.transform);

        playing = autoPlay;

        if (showDebugInfo)
        {
            arLocationDebugInfo = Utils.FindAndGetComponent <ARLocationDebugInfo>("ARLocationRoot");

            if (arLocationDebugInfo == null)
            {
                showDebugInfo = false;
            }
            else if (lineRenderer != null)
            {
                SetupDebugObjects();
            }
        }
    }
Exemple #12
0
    //public void RecvLocation(string RecLoc)
    //{
    //    RecLocation1 = RecLoc;
    //}

    // Use this for initialization
    private void Start()
    {
        //if (locationPath == null)
        //{
        //    throw new System.Exception("null location path");
        //}

        string RecLocation = PlayerPrefs.GetString("LocationPath");

        string word = "|";

        string[] words = RecLocation.Split(new string[] { word }, StringSplitOptions.None);
        int      cnt   = words.Length;

        pointCount = cnt;
        points     = new Vector3[pointCount];

        locationProvider = ARLocationProvider.Instance;
        locationProvider.OnLocationUpdated(LocationUpdated);

        manager = ARLocationManager.Instance;
        manager.OnRestart(OnRestartHandler);

        arLocationRoot = Utils.FindAndLogError("ARLocationRoot", "[ARLocationMoveAlongPath]: ARLocationRoot GameObject not found.");

        transform.SetParent(arLocationRoot.transform);

        if (showDebugInfo)
        {
            arLocationDebugInfo = Utils.FindAndGetComponent <ARLocationDebugInfo>("ARLocationRoot");

            if (arLocationDebugInfo == null)
            {
                showDebugInfo = false;
            }
            else
            {
                SetupDebugObjects();
            }
        }
    }