示例#1
0
    /// <summary>
    ///  Initializes the <see cref="workerBehaviour"/> and <see cref="worker"/>
    ///  member variables.
    /// </summary>
    /// <returns>
    ///  <c>true</c>, on success; <c>false</c> otherwise.
    /// </returns>
    protected bool InitWorkerReference()
    {
        // Worker already found?
        if (this.worker != null)
        {
            return(true);
        }

        // VLWorkerBeahaviour specified explicitly?
        if (this.workerBehaviour != null)
        {
            this.worker = this.workerBehaviour.GetWorker();
            return(this.worker != null);
        }

        // Look for it at the same GameObject first
        this.workerBehaviour =
            GetComponent <VLWorkerBehaviour>();
        if (this.workerBehaviour != null)
        {
            this.worker = this.workerBehaviour.GetWorker();
            return(this.worker != null);
        }

        // Try to find it anywhere in the scene
        this.workerBehaviour = FindObjectOfType <VLWorkerBehaviour>();
        if (this.workerBehaviour != null)
        {
            this.worker = this.workerBehaviour.GetWorker();
            return(this.worker != null);
        }

        return(false);
    }
示例#2
0
    private bool InitWorker()
    {
        // VLWorkerBeahaviour specified explicitly or previously found?
        if (this.workerBehaviour != null)
        {
            return(true);
        }

        // Try to get the VLWorkerBehaviour from the current GameObject
        this.workerBehaviour = GetComponent <VLWorkerBehaviour>();
        if (this.workerBehaviour != null)
        {
            return(true);
        }

        // If the current GameObject doesn't have a VLWorkerBehaviour
        // attached, just use the first VLWorkerBehaviour from anywhere in
        // the scene
        this.workerBehaviour = FindObjectOfType <VLWorkerBehaviour>();
        if (this.workerBehaviour != null)
        {
            return(true);
        }

        return(false);
    }
示例#3
0
    private void StartTracking()
    {
        // VLWorkerBeahaviour not specified explicitly?
        if (this.workerBehaviour == null)
        {
            // Try to get the VLWorkerBehaviour from the current GameObject
            this.workerBehaviour = GetComponent <VLWorkerBehaviour>();

            // If the current GameObject doesn't have a VLWorkerBehaviour
            // attached, just use the first VLWorkerBehaviour from anywhere in
            // the scene
            if (this.workerBehaviour == null)
            {
                this.workerBehaviour = FindObjectOfType <VLWorkerBehaviour>();

                // Failed to get VLWorkerBehaviour?
                if (this.workerBehaviour == null)
                {
                    return;
                }
            }
        }

        this.workerBehaviour.StartTracking(filename);

        if (this.visualAid != null)
        {
            this.visualAid.SetActive(true);
        }

        this.trackingStarted = true;
    }
示例#4
0
    /// <summary>
    ///  Acquires a reference to the VLWorkerBehavioiur and gathers the
    ///  VLDeviceInfo.
    /// </summary>
    private void Init()
    {
        // VLWorkerBeahaviour not specified explicitly?
        if (this.workerBehaviour == null)
        {
            // Try to get the VLWorkerBehaviour from the current GameObject
            this.workerBehaviour = GetComponent <VLWorkerBehaviour>();

            // If the current GameObject doesn't have a VLWorkerBehaviour
            // attached, just use the first VLWorkerBehaviour from anywhere in
            // the scene
            if (this.workerBehaviour == null)
            {
                this.workerBehaviour = FindObjectOfType <VLWorkerBehaviour>();

                // Failed to get VLWorkerBehaviour?
                if (this.workerBehaviour == null)
                {
                    return;
                }
            }
        }

        // Try to get the VLDeviceInfo
        this.deviceInfo = this.workerBehaviour.GetDeviceInfo();
        if (this.deviceInfo == null)
        {
            return;
        }

        this.initialized = true;
    }
示例#5
0
 private void Start()
 {
     worker = GetComponent <VLWorkerBehaviour>();
     worker.StartTracking("Examples/ModelTracking/ModelTracker.vl");
 }