Class AmbienceSource
Parallels UnityEngine.AudioSource, but instead of playing UnityEngine.AudioClip it plays an Ambience instead.
Requires a reference to UnityEngine.AudioSource to be an output of each ambience layer.
Inheritance
System.ObjectUnityEngine.ObjectUnityEngine.ComponentUnityEngine.BehaviourUnityEngine.MonoBehaviourAmbienceSourceNamespace: E7.TinyAmbience
Assembly: E7.TinyAmbience.dll
Syntax
[AddComponentMenu("Audio/Tiny Ambience/Ambience Source")]
public class AmbienceSource : MonoBehaviour
Properties
Ambience
Declaration
public Ambience Ambience { get; set; }
Property Value
| Type | Description |
|---|---|
Ambience |
AudioSource
Affects the next play if set while it is playing.
Declaration
public AudioSource AudioSource { get; set; }
Property Value
| Type | Description |
|---|---|
UnityEngine.AudioSource |
PlayOnAwake
Declaration
public bool PlayOnAwake { get; set; }
Property Value
| Type | Description |
|---|---|
System.Boolean |
TimeSource
Affects the next play if set while it is playing.
Declaration
public TimeSourceType TimeSource { get; set; }
Property Value
| Type | Description |
|---|---|
TimeSourceType |
Methods
Pause()
Temporarily stops all children game objects that are running each AmbienceLayer, not resetting the play head. (Definition of "play head" depends on layer mode.)
Call Resume() to continue from the paused spot.
Declaration
public void Pause()
Play()
Play with an ambience assigned in editor.
Throws if it is null.
Declaration
public void Play()
Play(Ambience)
Play with a custom ambience different from assigned E7.TinyAmbience.AmbienceSource.ambience.
Declaration
public void Play(Ambience a)
Parameters
| Type | Name | Description |
|---|---|---|
Ambience |
a |
Play(Ambience, PlayOptions)
Declaration
public void Play(Ambience a, PlayOptions playOptions)
Parameters
| Type | Name | Description |
|---|---|---|
Ambience |
a |
|
PlayOptions |
playOptions |
Play(IAmbienceLayerProvider)
Play with a custom ambience different from assigned E7.TinyAmbience.AmbienceSource.ambience.
Declaration
public void Play(IAmbienceLayerProvider a)
Parameters
| Type | Name | Description |
|---|---|---|
IAmbienceLayerProvider |
a |
Custom Ambience |
Play(IAmbienceLayerProvider, PlayOptions)
Declaration
public void Play(IAmbienceLayerProvider a, PlayOptions playOptions)
Parameters
| Type | Name | Description |
|---|---|---|
IAmbienceLayerProvider |
a |
|
PlayOptions |
playOptions |
Play(PlayOptions)
Play with an ambience assigned in editor.
Throws if it is null.
Declaration
public void Play(PlayOptions playOptions)
Parameters
| Type | Name | Description |
|---|---|---|
PlayOptions |
playOptions |
Resume()
Continue all children game objects to run each AmbienceLayer.
Nothing happens if you didn't call Pause() earlier. Calling Stop() while in Pause() will also remove the paused status.
Declaration
public void Resume()
Stop()
Stops all children game objects that are running each AmbienceLayer.
Declaration
public void Stop()