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