Beispiel #1
0
        public override void Initialize(Section owner)
        {
            graphics = (AnimatedGraphicsObject)ContentPackageManager.GetGraphicsResource("SMBCoin");
            IsMoving = false;
            collectSound = new CachedSound(ContentPackageManager.GetAbsoluteFilePath("nsmbwiiCoin"));

            base.Initialize(owner);
        }
 /// <summary>
 ///   Initializes a new instance of the <see
 ///   cref="CachedSoundSampleProvider" /> class.
 /// </summary>
 /// <param name="cachedSound">The sound to provide samples from.</param>
 public CachedSoundSampleProvider(CachedSound cachedSound)
 {
     this.cachedSound = cachedSound;
 }
Beispiel #3
0
        /// <summary>
        ///   Initializes a new instance of the <see cref="SectionExit" /> class.
        /// </summary>
        /// <param name="owner">The section this exit is in.</param>
        public SectionExit(Section owner)
        {
            Owner = owner;

            warpSound = new CachedSound(ContentPackageManager.GetAbsoluteFilePath("nsmbwiiWarpPipe"));
        }
Beispiel #4
0
 /// <summary>
 ///   Initializes this sound.
 /// </summary>
 public void Initialize()
 {
     soundData = new CachedSound(FilePath);
 }
Beispiel #5
0
        public SimplePlayer()
        {
            Size = new Vector2(16f);

            jumpSound = new CachedSound(ContentPackageManager.GetAbsoluteFilePath("nsmbwiiJump"));
        }
 /// <summary>
 ///   Plays a <see cref="CachedSound" /> instance.
 /// </summary>
 /// <param name="sound">The sound to play.</param>
 /// <param name="additionalOnPlaybackEndedHandler">
 ///   An event handler raised when the playback ends.
 /// </param>
 public void PlaySound(CachedSound sound, EventHandler additionalOnPlaybackEndedHandler)
 {
     //if (!playingSoundFileNames.Contains(sound.Name))
     //{
     CachedSoundSampleProvider provider = new CachedSoundSampleProvider(sound);
     playingSoundFileNames.Add(sound.Name);
     provider.PlaybackEndedEvent += (sender, e) => playingSoundFileNames.Remove(sound.Name);
     provider.PlaybackEndedEvent += additionalOnPlaybackEndedHandler;
     AddMixerInput(provider);
     //}
 }
        /// <summary>
        ///   Plays a <see cref="CachedSound" /> instance that fades in and/or out.
        /// </summary>
        /// <param name="sound">The sound to play.</param>
        /// <param name="additionalOnPlaybackEndedHandler">
        ///   An event handler raised when the playback ends.
        /// </param>
        /// <param name="beginFadeInAction">
        ///   An action called when the fade-in begins.
        /// </param>
        /// <param name="beginFadeOutAction">
        ///   An action called when the fade-out begins.
        /// </param>
        public void PlayFadeableSound(CachedSound sound, EventHandler additionalOnPlaybackEndedHandler, out Action<double> beginFadeInAction, out Action<double> beginFadeOutAction)
        {
            if (!playingSoundFileNames.Contains(sound.Name))
            {
                CachedSoundSampleProvider provider = new CachedSoundSampleProvider(sound);
                playingSoundFileNames.Add(sound.Name);
                provider.PlaybackEndedEvent += (sender, e) => playingSoundFileNames.Remove(sound.Name);
                provider.PlaybackEndedEvent += additionalOnPlaybackEndedHandler;

                FadeInFadeOutSampleProvider fadeSampleProvider = new FadeInFadeOutSampleProvider(provider);
                beginFadeInAction = fadeSampleProvider.BeginFadeIn;
                beginFadeOutAction = fadeSampleProvider.BeginFadeOut;

                AddMixerInput(fadeSampleProvider);
            }
            else
            {
                beginFadeInAction = beginFadeOutAction = (value) => { };
            }
        }