Пример #1
0
    public void ResetScene()
    {
        Debug.Log("Reset scene.");
        foreach (AnchorPosition anchorPos in SceneAnchorPositions)
        {
            Debug.Log($"Destroy anchorPos: {anchorPos.SpatialAnchorObject.Name}");
            Destroy(anchorPos.gameObject);
        }
        SceneAnchorPositions.Clear();

        // destroy current/previousAnchorPosition
        Debug.Log("Destroy currentAnchorPosition");
        if (currentAnchorPosition != null)
        {
            Destroy(currentAnchorPosition.gameObject);
        }

        Debug.Log("Destroy previousAnchorPosition");
        if (previousAnchorPosition != null)
        {
            Destroy(previousAnchorPosition.gameObject);
        }

        // reset anchorsToQuery
        Debug.Log("Reset spatialAnchorsInQuery list");
        spatialAnchorsInQuery.Clear();

        // stop watcher
        CanStopWatcher?.Invoke();

        // stop indicator
        CloseProgressIndicator(progressIndicatorRotatingOrbs);
    }
Пример #2
0
    private void HandleAnchorFound(string anchorId, AnchorPosition anchorPos)
    {
        anchorPos.Init(spatialAnchorsInQuery[anchorId]);
        anchorPos.AnchorConfirmed();
        if (!SceneAnchorPositions.Contains(anchorPos))
        {
            SceneAnchorPositions.Add(anchorPos);
            Debug.Log($"Add anchor position of '{anchorId}' to the scene");
        }
        else
        {
            Destroy(anchorPos);
        }

        currentAnchorPosition = anchorPos;


        Debug.Log($"Anchor '{spatialAnchorsInQuery[anchorId].Name}' have been found, removing from the query list ");
        spatialAnchorsInQuery.Remove(anchorId);


        if (spatialAnchorsInQuery.Count > 0)
        {
            Debug.Log($"continue finding '{spatialAnchorsInQuery.Count}' more spatial anchors... ... ...");
        }
        else
        {
            Debug.Log("successully found all spatial anchors queried");
            if (inNavigationMode)
            {
                StartCoroutine(GenerateTransitionLines());
                dialogController.OpenDialog("Ready to start the navigation", "Now we have successfully located both your selected origin and destination and are ready to start navigating. Do you want to start the navigation now?", "navigate");
                progressIndicatorRotatingOrbsGo.SetActive(false);
                CloseProgressIndicator(progressIndicatorRotatingOrbs);
                //ToggleIndicator(progressIndicatorRotatingOrbs);
            }
            else
            {
                // show indicator
                indicator.GetComponent <PositionIndicator>().SetTarget(currentAnchorPosition.transform);
                indicator.SetActive(true);
                // show dialog confirm whether wanting to create a new anchor
                dialogController.OpenDialog("Creating a new spatial anchor", "Do you want to create a new spatial anchor?", "create");
            }
            CanStopWatcher?.Invoke();
        }
    }