public void SetHotspot(Hotspot newHotspot, bool overrideInteralData = true) { hotspot = newHotspot; if (overrideInteralData) { iconIndex = newHotspot.iconIndex; colorIndex = newHotspot.colorIndex; _audioSrc.volume = newHotspot.soundVolume; filterDistortion.enabled = newHotspot.distortion > 0.1f; filterDistortion.distortionLevel = 0.9f; SetFreqCutoffComponents(newHotspot.freqCutoff); filterPhaser.setEnabled(Mathf.Abs(newHotspot.phaserLevel) > 0.1f); // Set the audioSource min/max distance in the correct order if (newHotspot.minDistance < _audioSrc.maxDistance) { soundMinDist = newHotspot.minDistance; soundMaxDist = newHotspot.maxDistance; } else if (newHotspot.maxDistance > _audioSrc.minDistance) { soundMaxDist = newHotspot.maxDistance; soundMinDist = newHotspot.minDistance; } else { soundMinDist = newHotspot.minDistance; soundMaxDist = newHotspot.maxDistance; soundMinDist = newHotspot.minDistance; } } }
/// <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(); }
public void SetHotspot(Hotspot newHotspot, bool overrideInteralData = true) { hotspot = newHotspot; if (overrideInteralData) { iconIndex = newHotspot.iconIndex; colorIndex = newHotspot.colorIndex; // Set the audioSource min/max distance in the correct order if (newHotspot.minDistance < audioSrc.maxDistance) { soundMinDist = newHotspot.minDistance; soundMaxDist = newHotspot.maxDistance; } else if (newHotspot.maxDistance > audioSrc.minDistance) { soundMaxDist = newHotspot.maxDistance; soundMinDist = newHotspot.minDistance; } else { soundMinDist = newHotspot.minDistance; soundMaxDist = newHotspot.maxDistance; soundMinDist = newHotspot.minDistance; } } }
// =========== // HOTSPOT METHODS public Hotspot AddNewHotspot(Vector3 localPos, Vector3 rotation, float minDist, float maxDist) { Hotspot h = new Hotspot(localPos, rotation, minDist, maxDist); layout.AddHotspot(h); layoutManagerDelegate?.LayoutManagerHotspotListChanged(this, layout); return(h); }
public void EraseHotspot(Hotspot hotspot) { if (layout == null) { return; } layout?.EraseHotspot(hotspot); layoutManagerDelegate?.LayoutManagerHotspotListChanged(this, layout); }
// ============ // SOUND FILE METHODS public void Bind(SoundMarker obj, Hotspot hotspot, bool startPlayback, bool reloadSoundClips) { AudioClip clip = soundDictionary.TryGetValue(hotspot.soundID, out SoundFile sf) ? sf.clip // If the sound is found, use it : SoundFile.defaultSoundFile.clip; // Fallback to default // bind these together obj.SetHotspot(hotspot, true); // with override color etc obj.LaunchNewClip(clip, playAudio: startPlayback); }
public void AddHotspot(Hotspot newHotspot) { if (hotspots == null) { this.hotspots = new List <Hotspot>(); } hotspots.Add(newHotspot); newHotspot.hotspotDelegate = this; Save(); }
public void EraseHotspot(Hotspot hotspot) { if (hotspot == null) { return; } // Save the Layout of the Hotspot was successfully removed if (hotspots.Remove(hotspot)) { Save(); } }
public void EraseHotspot(Hotspot hotspot) { if (hotspot == null) { return; } // Save the Layout of the Hotspot was successfully removed removeMarkerIDFromSynchronisedMarkers(hotspot.id, save: false); hotspots.Remove(hotspot); Save(); }
public void SetHotspot(Hotspot newHotspot, bool overrideInteralData = true) { hotspot = newHotspot; if (overrideInteralData) { iconIndex = newHotspot.iconIndex; colorIndex = newHotspot.colorIndex; _audioSrc.volume = newHotspot.soundVolume; _audioSrc.loop = newHotspot.loopAudio; soundShape = (SoundShape)newHotspot.soundShapeIndex; followCameraYPos.enabled = (soundShape == SoundShape.Column); filterDistortion.enabled = newHotspot.distortion > 0.1f; filterDistortion.distortionLevel = 0.9f; SetFreqCutoffComponents(newHotspot.freqCutoff); filterPhaser.setEnabled(Mathf.Abs(newHotspot.phaserLevel) > 0.1f); filterEcho.enabled = newHotspot.echoMagnitude > 0.1f; // filterEcho.wetMix = 0; // Set the audioSource min/max distance in the correct order if (newHotspot.minDistance < _audioSrc.maxDistance) { soundMinDist = newHotspot.minDistance; soundMaxDist = newHotspot.maxDistance; } else if (newHotspot.maxDistance > _audioSrc.minDistance) { soundMaxDist = newHotspot.maxDistance; soundMinDist = newHotspot.minDistance; } else { soundMinDist = newHotspot.minDistance; soundMaxDist = newHotspot.maxDistance; soundMinDist = newHotspot.minDistance; } } }