Inheritance: UnityEngine.MonoBehaviour
示例#1
0
        // Called when the GameObject is first created.
        protected override void Awake()
        {
            base.Awake();

            surfaceObserver = gameObject.GetComponent <SpatialMappingObserver>();
            Source          = surfaceObserver;
        }
        private void TryDetach(SpatialMappingSource spatialMappingSource)
        {
            if (spatialMappingSource != null)
            {
                spatialMappingSource.SurfaceAdded        -= HandleSurfaceAdded;
                spatialMappingSource.SurfaceUpdated      -= HandleSurfaceUpdated;
                spatialMappingSource.SurfaceRemoved      -= HandleSurfaceRemoved;
                spatialMappingSource.RemovingAllSurfaces -= HandleRemovingAllSurfaces;
            }

            inputMeshList.Clear();
        }
示例#3
0
        /// <summary>
        /// Sets the source of surface information.
        /// </summary>
        /// <param name="mappingSource">The source to switch to. Null means return to the live stream if possible.</param>
        public void SetSpatialMappingSource(SpatialMappingSource mappingSource)
        {
            UpdateRendering(false);

            if (mappingSource == null)
            {
                Source = surfaceObserver;
            }
            else
            {
                Source = mappingSource;
            }

            UpdateRendering(DrawVisualMeshes);
        }
        private void TryAttach(SpatialMappingSource spatialMappingSource)
        {
            if (spatialMappingSource != null)
            {
                spatialMappingSource.SurfaceAdded        += HandleSurfaceAdded;
                spatialMappingSource.SurfaceUpdated      += HandleSurfaceUpdated;
                spatialMappingSource.SurfaceRemoved      += HandleSurfaceRemoved;
                spatialMappingSource.RemovingAllSurfaces += HandleRemovingAllSurfaces;

                Debug.Assert(inputMeshList.Count == 0);

                foreach (var surface in spatialMappingSource.SurfaceObjects)
                {
                    inputMeshList.Add(CreateMeshData(surface, meshUpdateID: 0));
                }
            }
        }
 // Called when the GameObject is first created.
 private void Awake()
 {
     surfaceObserver = gameObject.GetComponent <SpatialMappingObserver>();
     Source          = surfaceObserver;
 }
示例#6
0
 // Called when the GameObject is first created.
 private void Awake()
 {
     surfaceObserver = gameObject.GetComponent <SpatialMappingObserver>();
     Source          = surfaceObserver;
     DontDestroyOnLoad(transform.gameObject);
 }