示例#1
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();
            }
        }
    }
示例#2
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();
            }
        }
    }