/// <summary>
        /// Triggered when the mode times out.
        /// </summary>
        protected override void Timeout()
        {
            // See if we need to finish up anything
            if (chestInfo != null)
            {
                // Just apply it where ever it is
                chestInfo.Apply(bonusSprite.Point);
            }

            // Loop through any remaining chests
            while (ChestCounter > 0)
            {
                chestInfo = ChestBonusInfo.Random;
                chestInfo.Apply(ChestSprite.Point);
                ChestCounter--;
            }

            // Change the mini mode to the new stage
            (Game.GameMode as PlayMode).MinorMode =
                new NewStageMinorMode();
        }
        /// <summary>
        /// Triggers an update of the mode's state.
        /// </summary>
        /// <param name="args"></param>
        public override void Update(UpdateArgs args)
        {
            // See if we have any chests left
            if (chestInfo == null && ChestCounter == 0)
            {
                // We don't, so finish up
                Timeout();
                return;
            }

            // If the chest is null, we need to start up a new chest
            if (chestInfo == null)
            {
                // Create a new chest
                ChestCounter--;
                chestInfo = ChestBonusInfo.Random;

                // Give it a time to live
                chestSeconds = Constants.ChestOpenFadeSpeed;

                // Create the sprites and direction
                bonusSprite = AssetLoader.Instance
                              .CreateSprite(chestInfo.BlockKey);
                bonusSprite.Point = ChestSprite.Point;
                fadeIn            = true;
                pause             = false;

                // Set up the text
                Title = chestInfo.Title;
                Text  = String.Format(chestInfo.Description,
                                      Game.State.SecondsPerTurn,
                                      Game.State.BugCount,
                                      Game.State.GrabCost,
                                      Game.State.Board.Columns);

                // Add it to the sprites
                Sprites.Add(bonusSprite);
            }
            else
            {
                // Increment the pointer
                chestSeconds -= args.SecondsSinceLastUpdate;

                // If we are negative, then we change mode
                if (chestSeconds < 0)
                {
                    // Switch mode
                    if (pause)
                    {
                        // Fade out
                        pause  = false;
                        fadeIn = false;
                    }
                    else if (fadeIn)
                    {
                        // Pause it
                        pause = true;

                        // Apply the value
                        chestInfo.Apply(bonusSprite.Point);
                    }
                    else
                    {
                        // Remove it
                        Sprites.Remove(bonusSprite);
                        chestInfo   = null;
                        bonusSprite = null;
                        return;
                    }

                    // Update the counter
                    chestSeconds = Constants.ChestOpenFadeSpeed;
                }
            }

            // Figure out the ratios (1 is just start, 0 is done)
            double timeRatio     = chestSeconds / Constants.ChestOpenFadeSpeed;
            float  positionRatio = (float)(timeRatio * BlockHeight);
            int    alpha         = (int)(255 * timeRatio);

            // Figure out the chest position
            if (pause)
            {
                // We aren't doing anything until the seconds change
                bonusSprite.Point = new PointF(
                    ChestSprite.Point.X,
                    ChestSprite.Point.Y - BlockHeight);
                tint = Color.White;
            }
            else if (fadeIn)
            {
                // Change the position based on the ratio
                bonusSprite.Point = new PointF(
                    ChestSprite.Point.X,
                    ChestSprite.Point.Y - BlockHeight + positionRatio);

                // Change the alpha based on the ratio
                tint = Color.FromArgb(255 - alpha, Color.White);
            }
            else
            {
                // Change the position based on the ratio
                bonusSprite.Point = new PointF(
                    ChestSprite.Point.X,
                    ChestSprite.Point.Y - 2 * BlockHeight + positionRatio);

                // Change the alpha based on the ratio
                tint = Color.FromArgb(alpha, Color.White);
            }

            // Move the sprite
            bonusSprite.Tint = tint;

            // Call the base
            base.Update(args);
        }
        /// <summary>
        /// Triggered when the mode times out. 
        /// </summary>
        protected override void Timeout()
        {
            // See if we need to finish up anything
            if (chestInfo != null)
            {
                // Just apply it where ever it is
                chestInfo.Apply(bonusSprite.Point);
            }

            // Loop through any remaining chests
            while (ChestCounter > 0)
            {
                chestInfo = ChestBonusInfo.Random;
                chestInfo.Apply(ChestSprite.Point);
                ChestCounter--;
            }

            // Change the mini mode to the new stage
            (Game.GameMode as PlayMode).MinorMode =
                new NewStageMinorMode();
        }