Ejemplo n.º 1
0
        private void DrawBars()
        {
            var position = this.Position.Clone();

            position.X += 10;
            position.Y += TEXT_HEIGHT;

            _totalBarWidth = this.Width - 20;
            var ending = Math.Max(Song.ConvertPhraseToMS(Song.GetEndingTimeInPhrase()) / 1000.0, AudioEnd);

            //Draw outro section.
            var width = AudioEnd / ending * _totalBarWidth;

            width = Math.Min(width, _totalBarWidth);
            _barParts.Draw(3, (int)width, _barHeight, position);

            //Draw playable section.
            width = (Length ?? Song.Length) / ending * _totalBarWidth;
            width = Math.Min(width, _totalBarWidth);
            _labelPositions[2] = (int)width;
            _barParts.Draw(2, (int)width, _barHeight, position);

            //Draw intro section.
            width = (Offset ?? Song.Offset) / ending * _totalBarWidth;
            width = Math.Min(width, _totalBarWidth);
            _labelPositions[1] = (int)width;
            _barParts.Draw(1, (int)width, _barHeight, position);

            //Draw skipped section.
            width = (AudioStart ?? Song.AudioStart) / ending * _totalBarWidth;
            width = Math.Min(width, _totalBarWidth);
            _labelPositions[0] = (int)width;
            _barParts.Draw(0, (int)width, _barHeight, position);
        }
Ejemplo n.º 2
0
        private void DrawEdges()
        {
            var position = this.Position.Clone();

            position.Y += TEXT_HEIGHT;
            _barEdges.Draw(0, 10, _barHeight, position);
            position.X += this.Width - 10;
            _barEdges.Draw(1, 10, _barHeight, position);
        }
Ejemplo n.º 3
0
 private void DrawEnteredTextBar(Vector2 position)
 {
     position.X += 25;
     _barSideSpriteMap.Draw(0, position);
     position.X               += 35;
     _barMiddleSprite.Width    = this.Width - 120;
     _barMiddleSprite.Position = position;
     _barMiddleSprite.Draw();
     position.X += this.Width - 120;
     _barSideSpriteMap.Draw(1, position);
 }
Ejemplo n.º 4
0
        private void DrawBlocks(double gameTime)
        {
            var beatFraction = GetBeatFraction(gameTime);

            int[] blockAssignments = AssignBlocks(beatFraction);

            float posX = this.X + 3;

            for (int y = 0; y < blockAssignments.Length; y++)
            {
                if ((blockAssignments[y] < 10) && (blockAssignments[y] > -1))
                {
                    _frontPart.ColorShading = Color.White;
                }
                else if (blockAssignments[y] >= 10)
                {
                    _frontPart.ColorShading = Color.DarkGray;
                    blockAssignments[y]    -= 10;
                }
                else
                {
                    _frontPart.ColorShading = Color.Black;
                }
                _frontPart.Draw(blockAssignments[y], BLOCK_WIDTH, this.Height - 6, posX + (BLOCK_WIDTH * y), this.Y + 3);
            }
        }
Ejemplo n.º 5
0
        private void DrawKeyboard()
        {
            var initialPosition = this.Position.Clone();
            var drawPosition    = this.Position.Clone();

            initialPosition.Y += 35;
            int counter = 0;

            foreach (char c in _chars)
            {
                drawPosition.X = (initialPosition.X) + (SpacingX * (counter % Columns));
                drawPosition.Y = (initialPosition.Y) + (SpacingY * (counter / Columns));
                if (counter == _selectedIndex)
                {
                    FontManager.DrawString("" + c, "TwoTech24", drawPosition, HighlightColor, FontAlign.Left);
                }
                else
                {
                    FontManager.DrawString("" + c, "TwoTech24", drawPosition, BaseColor, FontAlign.Left);
                }
                counter++;
            }

            for (int x = 0; x < 3; x++)
            {
                drawPosition.X             = (initialPosition.X) + (SpacingX * (counter % Columns));
                drawPosition.Y             = (initialPosition.Y) + (SpacingY * (counter / Columns));
                _specialChars.ColorShading = (_selectedIndex == _chars.Count() + x) ? HighlightColor : BaseColor;
                _specialChars.Draw(x, 25, 25, (int)drawPosition.X, (int)drawPosition.Y);
                counter++;
            }
        }
Ejemplo n.º 6
0
        private void DrawPulses(double phraseNumber)
        {
            if (DisablePulse)
            {
                return;
            }


            var pulsePosition = new Vector2 {
                X = this.X, Y = this.Y + 6
            };
            var pulseHeight   = this.Height - 12;
            var phraseDecimal = (phraseNumber - (int)phraseNumber);

            phraseDecimal = Math.Max(1 - (phraseDecimal * 4), 0);


            _pulseBack.ColorShading.A = (byte)(phraseDecimal * 255);
            _pulseFrontOpacity        = Math.Max(0,
                                                 _pulseFrontOpacity -
                                                 TextureManager.LastGameTime.ElapsedRealTime.TotalSeconds * PULSE_FADEOUT_SPEED);
            _pulseFront.ColorShading.A = (byte)_pulseFrontOpacity;

            _pulseFront.Draw(Id, this.Width, pulseHeight, pulsePosition);

            if (phraseNumber < 0.0)
            {
                return;
            }

            _pulseBack.Draw(Id, this.Width, pulseHeight, pulsePosition);
        }
Ejemplo n.º 7
0
        private void DrawPlayerIdentifier()
        {
            _indicatorPosition.Y = this.Y + this.Height - IdentifierSize.Y - 5;

            _indicatorPosition.X = this.X + this.Width - IdentifierSize.X - 5;
            _playerIdentifiers.Draw(Id, IdentifierSize.X, IdentifierSize.Y, _indicatorPosition);
        }
Ejemplo n.º 8
0
        private void DrawSingleBar(Vector2 position, int player, bool allPlayers)
        {
            _rightSprite.ColorShading.A          =
                _leftSpriteMap.ColorShading.A    =
                    _middleSprite.ColorShading.A = (byte)Opacity;
            _rightSprite.Size     = new Vector2(RIGHT_SIDE_WIDTH, this.Height);
            _rightSprite.Position = position.Clone();
            _rightSprite.X       += this.Width - RIGHT_SIDE_WIDTH;
            var barWidth       = this.Width - RIGHT_SIDE_WIDTH - LEFT_SIDE_WIDTH;
            var totalBeatlines = (from e in Players[player].Judgements select e).Take(6).Sum();

            var idx = (Players[player].IsCPUPlayer) ? 4 : player;

            if (allPlayers)
            {
                idx = 5;
            }
            _leftSpriteMap.Draw(idx, LEFT_SIDE_WIDTH, this.Height, position);
            position.X            += LEFT_SIDE_WIDTH;
            _middleSprite.Width    = barWidth;
            _middleSprite.Height   = this.Height;
            _middleSprite.Position = position.Clone();

            var maxWidth       = barWidth;
            var percentageText = " -----";

            if (totalBeatlines >= 5)
            {
                _partsSpriteMap.ColorShading.A = (byte)(_barOpacity * Opacity / 255);
                for (int y = 0; y < (int)BeatlineNoteJudgement.Count; y++)
                {
                    var width = (float)Math.Ceiling((barWidth) * Players[player].Judgements[y] / totalBeatlines);
                    width     = Math.Min(width, maxWidth);
                    maxWidth -= width;
                    _partsSpriteMap.Draw(y, width, this.Height, position);
                    position.X += width;
                }
                _barOpacity    = Math.Min(255, _barOpacity + (TextureManager.LastGameTime.ElapsedRealTime.TotalSeconds * BAR_SHOW_SPEED));
                percentageText = String.Format("{0:F1}%", Players[player].CalculatePercentage());
            }
            else
            {
                _barOpacity = 0;
            }
            _middleSprite.Draw();

            _rightSprite.Draw();
            _rightSprite.X += 35;
            _rightSprite.Y += (this.Height / 2) - 10;
            var textColour = Color.Black;

            textColour.A = (byte)Opacity;
            FontManager.DrawString(percentageText, "DefaultFont", _rightSprite.Position, textColour,
                                   FontAlign.Center);

            position.X = this.Position.X;
        }
Ejemplo n.º 9
0
        public override void Draw()
        {
            if (_judgementSprite == null)
            {
                _judgementSprite = new SpriteMap3D {
                    Columns = (int)BeatlineNoteJudgement.Count, Rows = 1, Texture = TextureManager.Textures("NoteJudgements" + TextureSuffix)
                };
            }
            _judgementSprite.ColorShading.A = Opacity;

            _judgementSprite.Draw(Tier, this.Width, this.Height, this.X, this.Y);
        }
Ejemplo n.º 10
0
        private void DrawBars()
        {
            _displayedLevel *= Multiplier;
            var diff = (Multiplier * Parent.Players[PlayerID].Level) - _displayedLevel;

            _displayedLevel += diff * Math.Min(TextureManager.LastDrawnPhraseDiff * FRONT_BAR_CHANGE_SPEED, 0.5);

            //The current progress towards the next level.
            double levelFraction = _displayedLevel - Math.Floor(_displayedLevel);
            //The calculated width of the level bar.
            var barWidth = (levelFraction * _maxBarWidth);

            if (LevelBarFull)
            {
                barWidth = _maxBarWidth;
            }

            _lastLevelDrawn = Math.Min(_lastLevelDrawn, (int)_displayedLevel - 1);

            //Level maxed out, draw a full bar.
            if (Math.Floor(_displayedLevel) - 1 > _lastLevelDrawn)
            {
                _lastLevelDrawn   = (int)((Parent.Players[PlayerID].Level * Multiplier) - 1);
                _lastLevelOpacity = 255;
            }
            //Draw the last level bar (gradually fading out) if appropriate.
            if (_lastLevelDrawn > 0)
            {
                _barSprite.ColorShading.A = Convert.ToByte(_lastLevelOpacity);
                _barSprite.Draw(_lastLevelDrawn - 1, _maxBarWidth, this.Height - 6, _barPosition);
                diff = TextureManager.LastDrawnPhraseDiff * FULL_BAR_FADEOUT_SPEED;
                _lastLevelOpacity = Math.Max(_lastLevelOpacity - diff, 0);
            }

            //Draw the current level bar.
            _barSprite.ColorShading.A = LevelBarFull ? (byte)255 : (byte)(40 + (215 * levelFraction));
            _barSprite.Draw(((int)(_displayedLevel - 1) % _barSprite.Rows), (float)barWidth, this.Height - 6, _barPosition);

            _displayedLevel /= Multiplier;
        }
Ejemplo n.º 11
0
        private void DrawNotes(double phraseNumber)
        {
            foreach (BeatlineNote bn in _beatlineNotes)
            {
                var markerBeatOffset = (_displayedSpeed * BEAT_ZOOM_DISTANCE * (phraseNumber - bn.Position));

                //Dont render notes outside the visibility range.
                if (((-1 * markerBeatOffset) > this.Width - LEFT_SIDE) && (!bn.Hit))
                {
                    continue;
                }

                var markerPosition = new Vector2 {
                    Y = this.Y + 6, X = CalculateNotePosition(bn, markerBeatOffset)
                };
                _markerSprite.ColorShading.A = CalculateNoteOpacity(bn, markerBeatOffset);

                var markerHeight = this.Height - 12;

                int noteIdx = 0;
                int width   = IMPACT_WIDTH;

                switch (bn.NoteType)
                {
                case BeatlineNoteType.Normal:
                    noteIdx = this.Id;
                    break;

                case BeatlineNoteType.Super:
                    noteIdx = 5;
                    break;

                case BeatlineNoteType.EndOfSong:
                case BeatlineNoteType.BPMIncrease:
                case BeatlineNoteType.BPMDecrease:
                case BeatlineNoteType.Stop:
                    width   = 1;
                    noteIdx = 4;
                    break;
                }

                _markerSprite.Draw(noteIdx, width, markerHeight, markerPosition);

                //Draw the effect icon on top of the marker if appropriate (such as a BPM change arrow)
                if ((bn.NoteType != BeatlineNoteType.Normal) && (bn.NoteType != BeatlineNoteType.Super))
                {
                    _beatlineEffects.ColorShading.A = (byte)(_markerSprite.ColorShading.A * 0.8);
                    _beatlineEffects.Draw((int)bn.NoteType - 1, EffectIconSize, new Vector2(markerPosition.X - EffectIconSize.X / 2.0f, markerPosition.Y));
                }
            }
        }
Ejemplo n.º 12
0
        public override void Draw()
        {
            if (Active)
            {
                _activeOpacity = Math.Min(_activeOpacity + (FADEIN_SPEED * TextureManager.LastGameTime.ElapsedRealTime.TotalSeconds), 255);
            }
            else
            {
                _activeOpacity = Math.Max(_activeOpacity - (FADEOUT_SPEED * TextureManager.LastGameTime.ElapsedRealTime.TotalSeconds), 0);
            }

            SetSpritePositions();
            _backgroundSprite.Draw();
            _textPosition.X = this.X + (this.Width / 2);
            _textPosition.Y = this.Y;
            FontManager.DrawString("" + SongSortMode, "TwoTechLarge", _textPosition, Color.Black, FontAlign.Center);

            _arrowSprites.ColorShading.A = (byte)_activeOpacity;
            _arrowSprites.Draw(1, 35, 35, this.X + 15, this.Y + 8);
            _arrowSprites.Draw(0, 35, 35, this.X + this.Width - 40, this.Y + 8);

            DrawList();
        }
Ejemplo n.º 13
0
        private void DrawChangeControls()
        {
            _indicatorArrows.ColorShading.A = (byte)_optionControlOpacity;
            _indicatorArrows.Draw(1, 15, 15, _difficultyTextPosition.X, _difficultyTextPosition.Y + 22);
            _indicatorArrows.Draw(0, 15, 15, _difficultyTextPosition.X + 15, _difficultyTextPosition.Y + 22);
            _indicatorArrows.Draw(2, 15, 15, _speedTextPosition.X - 32, _speedTextPosition.Y - 10);
            _indicatorArrows.Draw(3, 15, 15, _speedTextPosition.X - 17, _speedTextPosition.Y - 10);
            var speedText = string.Format("{0:0.0}x", Player.PlayerOptions.BeatlineSpeed);

            _textColor.A = (byte)_optionControlOpacity;
            FontManager.DrawString(speedText, "TwoTech20", _speedTextPosition, _textColor,
                                   FontAlign.Right);

            FontManager.DrawString("" + Player.PlayerOptions.PlayDifficulty, "TwoTech20", _difficultyTextPosition, _textColor,
                                   FontAlign.Left);

            if (Player.Profile != null)
            {
                FontManager.DrawString(String.Format("{0}/{1}", Player.GetEXP(), Player.GetNextEXPSafe()),
                                       "TwoTech20", _expTextPosition, _textColor,
                                       FontAlign.Center);
            }
        }
Ejemplo n.º 14
0
        private void DrawBorder(int startItem, int lastItem)
        {
            _edgeSpriteMap.ColorShading.A = Opacity;
            _edgeSpriteMap.Draw(0, this.Width, 30, this.X, this.Y);
            var menuBottom     = Math.Min(MaxVisibleItems, _menuItems.Count);
            var bottomPosition = this.Y + (ItemSpacing * menuBottom) + 40;

            _edgeSpriteMap.Draw(1, this.Width, 30, this.X, bottomPosition);
            _animationOffset = (int)(_animationOffset * 0.4);

            _sideSpriteMap.ColorShading.A = Opacity;
            _sideSpriteMap.Draw(0, 5, bottomPosition - this.Y - 30, this.X, this.Y + 30);
            _sideSpriteMap.Draw(0, 5, bottomPosition - this.Y - 30, this.X + this.Width - 5, this.Y + 30);

            _arrowSpriteMap.ColorShading.A = Opacity;
            if (startItem > 0)
            {
                _arrowSpriteMap.Draw(2, 25, 25, this.X + (this.Width / 2) - 12, this.Y);
            }
            if (lastItem < _menuItems.Count - 1)
            {
                _arrowSpriteMap.Draw(3, 25, 25, this.X + (this.Width / 2) - 12, bottomPosition);
            }
        }
Ejemplo n.º 15
0
        public override void Draw()
        {
            var idx = Player.IsCPUPlayer ? 4 : PlayerIndex;

            _background.Size     = this.Size;
            _background.Position = this.Position;
            _background.Draw();

            _playerIdentifiers.Draw(idx, 45, this.Height - 8, this.X + 3, this.Y + 4);
            _difficultyIcons.Draw((int)Player.PlayerOptions.PlayDifficulty + 1, 30, 30, this.X + 53, this.Y + 3);

            DrawNameBackgrounds();
            DrawText();
            DrawSpeedBlocks();
            DrawLevelBar();
        }
Ejemplo n.º 16
0
        public void DrawNonText()
        {
            var idx = IsSelected ? 1 : 0;

            _itemSpriteMap.ColorShading = GetBaseColour();

            _itemSpriteMap.ColorShading.A = Opacity;
            _textDrawColor.A = Opacity;
            _itemSpriteMap.Draw(idx, this.Size, this.Position);

            if (ClearColour >= 0)
            {
                _clearSpriteMap.ColorShading.A = Opacity;
                _clearSpriteMap.Draw(ClearColour, ClearIndicatorSize, this.Position);
            }
        }
Ejemplo n.º 17
0
        public override void Draw()
        {
            var position = this.Position.Clone();

            _songTypeBackgroundSpriteMap.Draw(_songIndex, this.Width, this.Height, position);
            position.Y += 1;
            position.X += 5;
            _songTypeIconSpriteMap.Draw(_songIndex, this.Height - 1, this.Height - 1, position);

            position.X = this.X + this.Width - 10;
            position.Y = this.Y + 1;
            var audioExt = Path.GetExtension(Song.AudioFile).ToUpper().TrimStart('.');
            var songExt  = Path.GetExtension(Song.DefinitionFile).ToUpper().TrimStart('.');

            FontManager.DrawString(audioExt, "DefaultFont", position, Color.Black, FontAlign.Right);
            position.Y += 16;
            FontManager.DrawString(songExt, "DefaultFont", position, Color.Black, FontAlign.Right);
        }
Ejemplo n.º 18
0
        public override void Draw()
        {
            float posX = this.X;
            float posY = this.Y;

            if (RednessSprite != null)
            {
                DrawRednessSprite();
            }

            var xdrawOffset = 0 - NumberCompleted() * NOTE_SIZE + (int)XDisplayOffset;
            var drawCount   = 0;

            foreach (Note note in Notes)
            {
                if (drawCount >= DisplayLimit)
                {
                    return;
                }
                var completedOffset = 0;
                var heightOffset    = (int)note.Direction * NOTE_SIZE / 3;
                var cell            = ((int)note.Direction);
                if (note.Completed)
                {
                    cell           += 8;
                    completedOffset = -6;
                }
                else if (note.Reverse)
                {
                    cell += 4;
                }

                _arrowsSpriteMap.ColorShading.A = (byte)(CalculateOpacity(xdrawOffset) * Opacity / 255);
                if (_arrowsSpriteMap.ColorShading.A > 0)
                {
                    _arrowsSpriteMap.Draw(cell, NOTE_SIZE, NOTE_SIZE, posX + xdrawOffset + completedOffset,
                                          posY + heightOffset);
                }
                xdrawOffset += NOTE_SIZE;
                drawCount++;
            }
        }
Ejemplo n.º 19
0
        private void DrawSingleBar(Vector2 position, int player, long challengeScore, long recordScore)
        {
            position = position.Clone();
            _rightSprite.ColorShading.A          =
                _leftSpriteMap.ColorShading.A    =
                    _middleSprite.ColorShading.A = (byte)Opacity;
            _rightSprite.Position = position.Clone();
            _rightSprite.Size     = new Vector2(RIGHT_SIDE_WIDTH, this.Height);
            _rightSprite.X       += this.Width - RIGHT_SIDE_WIDTH;
            var barWidth = this.Width - LEFT_SIDE_WIDTH - RIGHT_SIDE_WIDTH;

            var idx = (player < 5 && GameCore.Instance.Players[player].IsCPUPlayer) ? 4 : player;

            _leftSpriteMap.Draw(idx, LEFT_SIDE_WIDTH, this.Height, position);
            position.X            += LEFT_SIDE_WIDTH;
            _middleSprite.Width    = barWidth;
            _middleSprite.Height   = this.Height;
            _middleSprite.Position = position.Clone();

            _partsSpriteMap.ColorShading.A = (byte)Opacity;

            var ratio = 1.0 * challengeScore / recordScore;

            ratio = Math.Max(Math.Min(1.2, ratio), 0.8);
            var width = barWidth * (ratio - 0.8) / 0.4;

            _partsSpriteMap.Draw(GetBarColour(ratio), (float)width, this.Height, position);

            _middleSprite.Draw();
            _rightSprite.Draw();
            _rightSprite.X += RIGHT_SIDE_WIDTH / 2;
            _rightSprite.Y += (this.Height / 2) - 10;
            var textColour = Color.Black;

            textColour.A = (byte)Opacity;
            FontManager.DrawString("" + challengeScore, "DefaultFont", _rightSprite.Position, textColour,
                                   FontAlign.Center);
        }
Ejemplo n.º 20
0
        public override void Draw()
        {
            CalculatePositions();
            SetOpacity();
            _baseSprite.Draw();
            if (HighScoreEntry == null)
            {
                FontManager.DrawString("No score", "TwoTech24", _namePosition, _textColor,
                                       FontAlign.Center);
                return;
            }

            var displayedName = String.IsNullOrEmpty(HighScoreEntry.Name) ? "GUEST" : HighScoreEntry.Name;

            _gradeSpriteMap.Draw(HighScoreEntry.Grade, 71, 25, _gradePosition);
            _difficultySpriteMap.Draw((int)HighScoreEntry.Difficulty + 1, 25, 25, _difficultyPosition);
            var displayedScore = string.Format("{0:N0}", HighScoreEntry.Score).Replace((char)160, ',');

            FontManager.DrawString(displayedScore, "TwoTech24", _scorePosition, _textColor,
                                   FontAlign.Center);
            FontManager.DrawString("" + displayedName, "TwoTech24", _namePosition, _textColor,
                                   FontAlign.Center);
        }
Ejemplo n.º 21
0
        public override void Draw()
        {
            _backgroundSprite.Width    = this.Width;
            _backgroundSprite.Height   = this.Height;
            _backgroundSprite.Position = this.Position;
            _backgroundSprite.Draw();

            //Determine positions.
            _textPosition    = this.Position.Clone();
            _textPosition.X += 60;
            _textPosition.Y += 13;
            _iconPosition    = this.Position.Clone();
            _iconPosition.X += 10;
            _iconPosition.Y += 12;

            //Draw controller Icon
            if (ControllerNumber > 0)
            {
                _controllerNumberSpriteMap.Draw(ControllerNumber - 1, 30, 30, _iconPosition);
                if (_buttonsLookup.Contains(Button))
                {
                    _textPosition.Y -= 3;
                    var btnIndex = _buttonsLookup.IndexOf(Button);
                    _controllerButtonsSpriteMap.Draw(btnIndex, 30, 30, _textPosition);
                }
                else
                {
                    FontManager.DrawString(Button.ToString(), "LargeFont", _textPosition, Color.Black, FontAlign.Left);
                }
            }
            else
            {
                _keyboardIcon.Position = _iconPosition;
                _keyboardIcon.Draw();
                FontManager.DrawString(Key.ToString(), "LargeFont", _textPosition, Color.Black, FontAlign.Left);
            }
        }
Ejemplo n.º 22
0
        private void DrawBPMMeter()
        {
            var changeMx = Math.Min(0.5, TextureManager.LastGameTime.ElapsedRealTime.TotalSeconds * BPM_LENGTH_ANIMATION_SPEED);

            var diff = _displayedMinBpm - _actualMinBpm;

            _displayedMinBpm -= (diff * (changeMx));

            diff              = _displayedMaxBpm - _actualMaxBpm;
            _displayedMaxBpm -= (diff * (changeMx));

            var beatFraction = (SongTime) - Math.Floor(SongTime);

            beatFraction *= BEAT_FRACTION_SEVERITY;

            var meterBPM = Math.Max(BpmLevels[BpmLevels.Count() - 1], DisplayedSong.StartBPM * (1 - beatFraction));


            float height = (this.Height - 2) / _meterSprite.Rows;

            for (int x = 0; x < BpmLevels.Count(); x++)
            {
                if ((meterBPM >= BpmLevels[x]))
                {
                    _meterSprite.ColorShading = Color.White;
                }
                else
                {
                    _meterSprite.ColorShading = _notLitColor;
                }
                _meterSprite.Draw(x, this.Width, height, _baseSprite.X, _baseSprite.Y + (x * height));
            }

            DrawBPMText();
            DrawWarningIcon();
        }
Ejemplo n.º 23
0
        public override void Draw(double gameTime)
        {
            if (_basePart == null)
            {
                InitSprites();
            }

            _blocksCount = (int)Math.Ceiling((this.Width - BAR_X_OFFSET - 8) / (double)FRONT_WIDTH);
            var solidLife = Math.Min(_displayedLife, 100);

            //Causes the bar to pulse on every beat.
            gameTime *= 4;
            var beatFraction = (gameTime) - Math.Floor(gameTime);

            beatFraction *= BEAT_FRACTION_SEVERITY;

            //Causes the bar to not pulse before the first beat.
            if (gameTime >= 0)
            {
                solidLife *= (1 - beatFraction);
            }

            Debug.Assert(_basePart != null);
            _basePart.Draw();

            //Draw each block in sequence. Either in colour, or black depending on the Player's life.
            var highestBlock = GetHighestBlockLevel();
            var startPoint   = this.X + BAR_X_OFFSET;

            for (int x = 0; x < _blocksCount; x++)
            {
                var minLife = LIFEBAR_CAPACITY / _blocksCount * x;
                if (solidLife > minLife)
                {
                    _frontPart.ColorShading = Color.White;
                }
                else if (x == highestBlock)
                {
                    _frontPart.ColorShading = Color.LightGray;
                }
                else
                {
                    _frontPart.ColorShading = Color.Black;
                }
                _frontPart.Draw(PlayerID, FRONT_WIDTH, this.Height - 6, startPoint + (FRONT_WIDTH * x), this.Y + 3);
            }

            UpdateDisplayedLife();


            _gridPart.DrawTiled(0, 0, this.Width - BAR_X_OFFSET, this.Height - 6);

            //Draw the overcharge above the normal bar.
            DrawFirstOvercharge();
            DrawSecondOvercharge();

            DrawBlazingEffect(beatFraction);
            DrawFullEffect();

            DrawText();
            UpdateOverchargeTexture();
        }