/// <summary> /// Creates a SoundConnection. You can use a scene name or a custom name. Will default to ContinousPlayThrough. /// </summary> /// <returns> /// The SoundConnection. /// </returns> /// <param name='lvl'> /// The level name of the SoundConnection. /// </param> /// <param name='audioList'> /// Audio list. /// </param> public static SoundConnection CreateSoundConnection(string lvl, params AudioClip[] audioList) { SoundConnection sc = new SoundConnection(lvl, SoundManager.PlayMethod.ContinuousPlayThrough, audioList); if (!Application.CanStreamedLevelBeLoaded(lvl)) { sc.SetToCustom(); } return(sc); }
/// <summary> /// Creates a SoundConnection. You can use a scene name or a custom name. This overload is used for PlayMethods that use Random Delay In Range. /// </summary> /// <returns> /// The SoundConnection. /// </returns> /// <param name='lvl'> /// The level name of the SoundConnection. /// </param> /// <param name='method'> /// The PlayMethod. /// </param> /// <param name='minDelayPlay'> /// The minimum delay. /// </param> /// <param name='maxDelayPlay'> /// The maximum delay. /// </param> /// <param name='audioList'> /// Audio list. /// </param> public static SoundConnection CreateSoundConnection(string lvl, SoundManager.PlayMethod method, float minDelayPlay, float maxDelayPlay, params AudioClip[] audioList) { SoundConnection sc = new SoundConnection(lvl, method, minDelayPlay, maxDelayPlay, audioList); if (!Application.CanStreamedLevelBeLoaded(lvl)) { sc.SetToCustom(); } return(sc); }
private void AddSoundConnection() { SoundManagerEditorTools.RegisterObjectChange("Add SoundConnection", script); SoundConnection sc = null; switch (playMethodToAdd) { case SoundManager.PlayMethod.ContinuousPlayThrough: case SoundManager.PlayMethod.OncePlayThrough: case SoundManager.PlayMethod.ShufflePlayThrough: sc = new SoundConnection(levelToAdd, playMethodToAdd, soundsToAdd.ToArray()); break; case SoundManager.PlayMethod.ContinuousPlayThroughWithDelay: case SoundManager.PlayMethod.OncePlayThroughWithDelay: case SoundManager.PlayMethod.ShufflePlayThroughWithDelay: sc = new SoundConnection(levelToAdd, playMethodToAdd, delayToAdd, soundsToAdd.ToArray()); break; case SoundManager.PlayMethod.ContinuousPlayThroughWithRandomDelayInRange: case SoundManager.PlayMethod.OncePlayThroughWithRandomDelayInRange: case SoundManager.PlayMethod.ShufflePlayThroughWithRandomDelayInRange: sc = new SoundConnection(levelToAdd, playMethodToAdd, minDelayToAdd, maxDelayToAdd, soundsToAdd.ToArray()); break; } if (isCustom) { sc.SetToCustom(); levelToAdd = defaultName; repaintNextFrame = true; } script.soundConnections.Add(sc); RecalculateBools(); EditorUtility.SetDirty(script); SceneView.RepaintAll(); }
private void AddSoundConnection() { SoundManagerEditorTools.RegisterObjectChange("Add SoundConnection", script); SoundConnection sc = null; switch (playMethodToAdd) { case SoundManager.PlayMethod.ContinuousPlayThrough: case SoundManager.PlayMethod.OncePlayThrough: case SoundManager.PlayMethod.ShufflePlayThrough: sc = new SoundConnection(levelToAdd, playMethodToAdd, soundsToAdd.ToArray()); break; case SoundManager.PlayMethod.ContinuousPlayThroughWithDelay: case SoundManager.PlayMethod.OncePlayThroughWithDelay: case SoundManager.PlayMethod.ShufflePlayThroughWithDelay: sc = new SoundConnection(levelToAdd, playMethodToAdd, delayToAdd, soundsToAdd.ToArray()); break; case SoundManager.PlayMethod.ContinuousPlayThroughWithRandomDelayInRange: case SoundManager.PlayMethod.OncePlayThroughWithRandomDelayInRange: case SoundManager.PlayMethod.ShufflePlayThroughWithRandomDelayInRange: sc = new SoundConnection(levelToAdd, playMethodToAdd, minDelayToAdd, maxDelayToAdd, soundsToAdd.ToArray()); break; } if(isCustom) { sc.SetToCustom(); levelToAdd = defaultName; repaintNextFrame = true; } script.soundConnections.Add(sc); RecalculateBools(); EditorUtility.SetDirty(script); SceneView.RepaintAll(); }