Esempio n. 1
0
        public void Draw(Player player)
        {
            if (m_lifebg0.DataMap.Type == ElementType.Static || m_lifebg0.DataMap.Type == ElementType.Animation)
            {
                m_lifebg0.Draw(m_lifebarposition);
            }

            if (m_lifebg1.DataMap.Type == ElementType.Static || m_lifebg1.DataMap.Type == ElementType.Animation)
            {
                m_lifebg1.Draw(m_lifebarposition);
            }

            if (m_lifeMid.DataMap.Type == ElementType.Static)
            {
                var lifePercentage = m_damage / (float)player.Constants.MaximumLife;

                var drawstate = m_lifeMid.SpriteManager.SetupDrawing(m_lifeMid.DataMap.SpriteId, m_lifebarposition,
                                                                     Vector2.Zero, m_lifeMid.DataMap.Scale, m_lifeMid.DataMap.Flip);
                drawstate.ScissorRectangle =
                    DrawState.CreateBarScissorRectangle(m_lifeMid, m_lifebarposition, lifePercentage, m_lifebarRange);
                drawstate.Use();
            }

            if (m_lifeFront.DataMap.Type == ElementType.Static)
            {
                var lifePercentage = Math.Max(0.0f, player.Life / (float)player.Constants.MaximumLife);

                var drawstate = m_lifeFront.SpriteManager.SetupDrawing(m_lifeFront.DataMap.SpriteId, m_lifebarposition,
                                                                       Vector2.Zero, m_lifeFront.DataMap.Scale, m_lifeFront.DataMap.Flip);
                drawstate.ScissorRectangle =
                    DrawState.CreateBarScissorRectangle(m_lifeFront, m_lifebarposition, lifePercentage, m_lifebarRange);
                drawstate.Use();
            }
        }
Esempio n. 2
0
        private void DrawPowerbar(Player player)
        {
            if (player == null)
            {
                throw new ArgumentNullException(nameof(player));
            }

            if (m_powerbg0.DataMap.Type == ElementType.Static || m_powerbg0.DataMap.Type == ElementType.Animation)
            {
                m_powerbg0.Draw(m_powerbarposition);
            }

            if (m_powerbg1.DataMap.Type == ElementType.Static || m_powerbg1.DataMap.Type == ElementType.Animation)
            {
                m_powerbg1.Draw(m_powerbarposition);
            }

            if (m_powermid.DataMap.Type == ElementType.Static || m_powermid.DataMap.Type == ElementType.Animation)
            {
                //m_powermid.Draw(m_powerbarposition);
            }

            if (m_powerfront != null && m_powerfront.DataMap.Type == ElementType.Static)
            {
                var powerPercentage = Math.Max(0.0f, player.Power / (float)player.Constants.MaximumPower);

                var drawstate = m_powerfront.SpriteManager.SetupDrawing(m_powerfront.DataMap.SpriteId,
                                                                        m_powerbarposition, Vector2.Zero, m_powerfront.DataMap.Scale, m_powerfront.DataMap.Flip);
                drawstate.ScissorRectangle = DrawState.CreateBarScissorRectangle(m_powerfront, m_powerbarposition,
                                                                                 powerPercentage, m_powerbarrange);
                drawstate.Use();
            }

            if (m_powercounter.DataMap.Type == ElementType.Text)
            {
                var powertext = (player.Power / 1000).ToString();
                m_team.Engine.Print(m_powercounter.DataMap.FontData, m_powerbarposition + m_powercounter.DataMap.Offset,
                                    powertext, null);
            }
        }