Class AudioManagerBase
Implements
Namespace: RTSEngine.Audio
Assembly: cs.temp.dll.dll
Syntax
public abstract class AudioManagerBase : MonoBehaviour, IAudioManager
Properties
Data
Declaration
public AudioData Data { get; }
Property Value
Type | Description |
---|---|
AudioData |
IsMusicActive
Are the music loops currently active and playing?
Declaration
public bool IsMusicActive { get; }
Property Value
Type | Description |
---|---|
Boolean |
logger
Declaration
protected ILoggingService logger { get; }
Property Value
Type | Description |
---|---|
ILoggingService |
Methods
InitBase(ILoggingService)
Declaration
protected void InitBase(ILoggingService logger)
Parameters
Type | Name | Description |
---|---|---|
ILoggingService | logger |
OnAudioDataUpdated()
Declaration
protected virtual void OnAudioDataUpdated()
OnDisabled()
Declaration
protected virtual void OnDisabled()
OnMusicVolumeSliderUpdated()
Called when the music's volume slider's value is updated.
Declaration
public void OnMusicVolumeSliderUpdated()
OnSFXVolumeSliderUpdated()
Called when the local and global SFX volume slider's value is updated.
Declaration
public void OnSFXVolumeSliderUpdated()
PlayMusic()
Starts playing the music loops.
Declaration
public void PlayMusic()
PlayNextMusicTrack()
Declaration
public void PlayNextMusicTrack()
PlayPreviousMusicTrack()
Declaration
public void PlayPreviousMusicTrack()
PlaySFX(AudioClip, IEntity, Boolean)
Plays an AudioClip instance in the global SFX audio source (Used for global sound effects).
Declaration
public void PlaySFX(AudioClip clip, IEntity source, bool loop = false)
Parameters
Type | Name | Description |
---|---|---|
AudioClip | clip | AudioClip instance to be played. |
IEntity | source | |
Boolean | loop | When true, the audio clip will be looped. |
PlaySFX(AudioSource, AudioClip, Boolean)
Plays an AudioClip instance on a given AudioSource instance (Used for local sound effects).
Declaration
public void PlaySFX(AudioSource inputSource, AudioClip inputClip, bool loop = false)
Parameters
Type | Name | Description |
---|---|---|
AudioSource | inputSource | AudioSource instance to play the clip. |
AudioClip | inputClip | AudioClip instance to be played. |
Boolean | loop | When true, the audio clip will be looped. |
PlaySFX(AudioSource, AudioClipFetcher, Boolean)
Declaration
public void PlaySFX(AudioSource source, AudioClipFetcher fetcher, bool loop = false)
Parameters
Type | Name | Description |
---|---|---|
AudioSource | source | |
AudioClipFetcher | fetcher | |
Boolean | loop |
PlaySFX(AudioClipFetcher, IEntity, Boolean)
Declaration
public void PlaySFX(AudioClipFetcher fetcher, IEntity source, bool loop = false)
Parameters
Type | Name | Description |
---|---|---|
AudioClipFetcher | fetcher | |
IEntity | source | |
Boolean | loop |
StopMusic()
Stops playing music loops.
Declaration
public void StopMusic()
StopSFX()
Stops playing audio from the global SFX audio source.
Declaration
public void StopSFX()
StopSFX(AudioSource)
Stops playing audio from an AudioSource instance (Used for local sound effects).
Declaration
public void StopSFX(AudioSource source)
Parameters
Type | Name | Description |
---|---|---|
AudioSource | source | AudioSource instance to stop. |
UpdateMusicVolume(Single)
Updates the volume of the music loops.
Declaration
public void UpdateMusicVolume(float volume)
Parameters
Type | Name | Description |
---|---|---|
System.Single | volume | The new volume value for the music loops. |
UpdateSFXVolume(Single)
Updates the volume of the local SFX AudioSource instances (coming from units, buildings, resources and attack objects) and the global SFX AudioSource instance.
Declaration
public void UpdateSFXVolume(float volume)
Parameters
Type | Name | Description |
---|---|---|
System.Single | volume | The new volume value for the local and global audio sources. |