예제 #1
0
        /// <summary>
        /// Place the next sound marker
        /// </summary>
        private void PlaceSoundTapped()
        {
            // Place a new sound with default config
            SoundMarker soundIconObj = null;

            // Create and position the prefab.
            if (canvasControl.placeSoundsOverlay.placeSoundsOnCursor && cursorTransform != null)
            {
                soundIconObj = SoundMarker.CreatePrefab(cursorTransform, soundMarkerPrefab, anchorWrapperTransform);
            }
            else
            {
                soundIconObj = SoundMarker.CreatePrefab(firstPersonCamera.transform, soundMarkerPrefab, anchorWrapperTransform);
            }
            Anchor  anchorParent = soundIconObj.transform.parent.GetComponent <Anchor>();
            Vector3 anchorPos    = anchorParent.transform.localPosition;

            // Create a new hotspot for the json file and save it.
            soundMarkers.Add(soundIconObj);

            Hotspot h = layoutManager.AddNewHotspot(
                localPos: anchorPos,
                rotation: Vector3.zero,
                minDist: defaultMinDistance * 0.5f,
                maxDist: canvasControl.placeSoundsOverlay.maxRadiusSlider.radiusValue);

            layoutManager.Bind(soundIconObj, h, !playbackIsStopped);

            soundIconObj.SetIconAndRangeToRandomValue();
        }
예제 #2
0
 /// <summary>
 /// Update the scene data and place the corresponding sources
 /// </summary>
 public void LoadData()
 {
     // remove the previous
     UnloadCurrentSoundMarkers();
     // set up all the hotspots
     layoutManager.LoadCurrentLoudout();
     // Bind all the sounds to their game objects
     foreach (Hotspot h in layoutManager.layout.hotspots)
     {
         var pf = SoundMarker.CreatePrefab(
             anchorWrapperTransform.TransformPoint(h.positon),
             h.rotation, soundMarkerPrefab, anchorWrapperTransform);
         SoundMarker soundObj = pf.GetComponent <SoundMarker>();
         layoutManager.Bind(soundObj, h, !playbackIsStopped);
         soundMarkers.Add(pf);
     }
 }