Inheritance: IContent
示例#1
0
        /// <summary>
        /// Initializes a new AudioEffect class.
        /// </summary>
        /// <param name="audioSource">The AudioSource.</param>
        public AudioEffect(AudioSource audioSource)
        {
            AudioSource = audioSource;
            var audioInitializer = SGL.QueryComponents<AudioManager>().AudioInitializer;
            var logger = LogManager.GetClassLogger();

            if (audioInitializer == null)
            {
                logger.Warn("The specified audio initializer was null.");
            }
            else if (!audioInitializer.IsSupported)
            {
                logger.Warn("The specified AudioProvider is not supported.");
            }
            else
            {
                _audioProvider = audioInitializer.Create();
                _audioProvider.PlaybackChanged += PlaybackChanged;
            }
        }
 /// <summary>
 /// Initializes the audio effect fluently.
 /// </summary>
 /// <param name="effect">The AudioEffect.</param>
 /// <param name="audioSource">The AudioSource.</param>
 /// <returns>AudioEffect.</returns>
 public static AudioEffect FluentInitialize(this AudioEffect effect, AudioSource audioSource)
 {
     effect.AudioSource = audioSource;
     effect.Initialize();
     return effect;
 }
示例#3
0
 /// <summary>
 /// Initializes the audio manager with the given audio source.
 /// </summary>
 /// <param name="audioSource">The AudioSource.</param>
 public void Initialize(AudioSource audioSource)
 {
     _audioProvider.Initialize(audioSource.Instance);
 }