WaveFrogger.Services.AudioService.Update C# (CSharp) Method

Update() public method

Updates the specified game time.
public Update ( System.TimeSpan gameTime ) : void
gameTime System.TimeSpan The game time.
return void
        public override void Update(TimeSpan gameTime)
        {
            if (this.musicFadeTimer.TotalSeconds > 0)
            {
                this.musicFadeTimer -= gameTime;

                if (this.musicFadeTimer.TotalSeconds <= 0)
                {
                    this.musicFadeTimer = TimeSpan.Zero;
                    this.MusicVolume = MUSIC_VOLUME;
                }
                else
                {
                    var amount = (float)(1 - (this.musicFadeTimer.TotalSeconds / MUSIC_FADEIN_SECONDS));
                    this.MusicVolume = MathHelper.Lerp(MUSIC_VOLUME * 0.5f, MUSIC_VOLUME, amount);
                }
            }
        }