A class in Root.Township, the global namespace.
Plays a sound effect over and over on a fixed timer until cancelled. Stops when disabled.
Constructors
| Member | What it is |
|---|
LoopingSoundEffect() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
5 private and internal fields
| Member | What it is |
|---|
private bool isLooping | Backing field for IsPlaying. |
private int loopingSfxDurationInMilliseconds | Loop length in milliseconds, from the seconds value. |
private float loopingSfxDurationInSeconds | Time between each replay of the sound. |
private AudioControl loopingSoundAudioControl | Audio control of the last play, used to stop it. |
private SoundEffectSet loopSoundEffect | The sound effect to loop. |
Properties
| Member | What it is |
|---|
bool IsPlaying { get; } | Whether the loop is running. |
Methods
| Member | What it is |
|---|
void CancelLoop() | Stops looping and stops the playing sound. |
void StartLoop() | Starts looping the sound. |
3 private and internal methods
| Member | What it is |
|---|
private void Awake() | Converts the loop length to milliseconds. |
private async void LoopSound() | Plays the sound at this object, waits the loop length, and repeats while looping. |
private void OnDisable() | Cancels the loop. |
Used in
Members of other types that take, return or hold a LoopingSoundEffect: