/// <summary> /// Start is called before the first frame update /// </summary> void Start() { observer = GetComponent <SpatialObserverHandler>(); isCreatingPlanes = false; detectedSurfacePlanes = new List <SurfacePlane>(); SurfacePlanesParent = CreateCollectionParent("SurfacePlaneCollection"); roomTagParent = CreateCollectionParent("RoomTagCollection"); }
/// <summary> /// Start is called before the first frame update. /// </summary> void Start() { converter = GetComponent <SpatialMeshConversionHandler>(); observer = GetComponent <SpatialObserverHandler>(); calculator = gameObject.GetComponent <RoomVolumeCalculationHandler>(); // Register for the create surface planes complete event converter.CreateSurfacePlanesCompletedEvent += CreateSurfacePlanesCompletedEventHandler; }
/// <summary> /// Start is called before the first frame update. /// </summary> void Start() { GameObject spatialProcessing = GameObject.Find("SpatialProcessing"); observer = spatialProcessing.GetComponent <SpatialObserverHandler>(); converter = spatialProcessing.GetComponent <SpatialMeshConversionHandler>(); Debug.Log(Time.realtimeSinceStartup); PlaceLight(); StartCoroutine(CreateSphereRayCastToMesh()); }
/// <summary> /// Initializes the lighting unit game object. /// </summary> /// <param name="b"></param> public void Init(LightingUnit b, int index) { bulb = b; this.index = index; GameObject spatialProcessing = GameObject.Find("SpatialProcessing_and_RoomVolumeCalculation"); converter = spatialProcessing.GetComponent <SpatialMeshConversionHandler>(); observer = spatialProcessing.GetComponent <SpatialObserverHandler>(); }
/// <summary> /// Finds the surface planes in the scene and set them active. /// Helps to find locations where the power outlets can be attached. /// </summary> private void SetPlaneCollectionActive() { GameObject spatialProcessing = GameObject.Find("SpatialProcessing"); if (spatialProcessing == null) { spatialProcessing = GameObject.Find("SpatialProcessing_and_RoomVolumeCalculation"); } observer = spatialProcessing.GetComponent <SpatialObserverHandler>(); converter = spatialProcessing.GetComponent <SpatialMeshConversionHandler>(); planeCollection = converter.SurfacePlanesParent; planeCollection.SetActive(true); }
/// <summary> /// Start is called before the first frame update. /// </summary> void Start() { // Acess the set power outlets powerOutletPlacing = GameObject.Find("PowerOutletCollection").GetComponent <PowerOutletPlacementHandler>(); // The power outlets are ordered by range so that first a lighting unit is placed at the power outlet with the largest range outlets = powerOutletPlacing.PowerOutletCollection.OrderByDescending(d => d.range).ToList(); // Access and update the combined mesh GameObject spatialProcessing = GameObject.Find("SpatialProcessing_and_RoomVolumeCalculation"); observer = spatialProcessing.GetComponent <SpatialObserverHandler>(); calculator = spatialProcessing.GetComponent <RoomVolumeCalculationHandler>(); observer.SetMeshDisplayOption(SpatialAwarenessMeshDisplayOptions.None); combinedMesh = observer.CombinedMesh; combinedMesh.subMeshCount = outlets.Count; remainingTriangles = combinedMesh.triangles.ToList(); CreateRecommendation(); }