예제 #1
0
        /// <summary>
        /// Renders everything related to the Player, including UI elements.
        /// </summary>
        public override void Process()
        {
            CRenderable renderable = World.GetComponent <CRenderable>(PlayerSystem.PLAYER_ENTITY_ID);
            CHealth     health     = World.GetComponent <CHealth>(PlayerSystem.PLAYER_ENTITY_ID);
            CPlayer     player     = World.GetComponent <CPlayer>(PlayerSystem.PLAYER_ENTITY_ID);

            RenderCooldowns(player);
            RenderShop(player);
            RenderHealthBar(health);
        }
예제 #2
0
        /// <summary>
        /// Renders the Player's health bar. This is done separately to the HealthRenderingSystem
        /// as the Player's health bar is not rendered relative to its position.
        /// </summary>
        /// <param name="health">Health.</param>
        private void RenderHealthBar(CHealth health)
        {
            SwinGame.DrawBitmap(_hpText, 120, 10);
            SwinGame.FillRectangle(Color.DarkGreen, 150, 5, HEALTH_BAR_WIDTH, 20); //Draw health bar

            if (health.Damage > 0)
            {
                float damageBarWidth = (HEALTH_BAR_WIDTH * ((float)health.Damage / health.Health));
                SwinGame.FillRectangle(Color.Red, 150, 5, damageBarWidth, 20); //Draw damage bar
            }
        }