상속: 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;
            }
        }
예제 #2
0
 /// <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);
 }