Ignore:
Timestamp:
2013-07-28 23:40:27 (6 years ago)
Author:
dezhidki
Message:

Lisätty vihollisen kunikaan elämäpalkki

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 2013/30/DenisZ/CastleMaster/CastleMaster/CastleMaster/Guis/GuiPlayer.cs

    r4728 r4751  
    2121            private int oldUnitHealthBarWidth = HEALTH_BAR_WIDTH; 
    2222            private string text; 
     23            private Color textColor; 
    2324 
    24             public HealthMeter(Unit unit, Vector2 renderPos, string text) 
     25            public HealthMeter(Unit unit, Vector2 renderPos, string text, Color textColor) 
    2526            { 
    2627                this.text = text; 
    2728                this.unit = unit; 
     29                this.textColor = textColor; 
    2830                unitHealthGreenRectangle = new Rectangle(0, 0, HEALTH_BAR_WIDTH, 4); 
    2931                unitHealthRedRectangle = new Rectangle(HEALTH_BAR_WIDTH, 4, 0, 4); 
     
    4749            public void Render(RenderHelper renderer) 
    4850            { 
    49                 renderer.SpriteBatch.DrawString(Resources.FONT, text, unitTextPos, Color.White); 
     51                renderer.SpriteBatch.DrawString(Resources.FONT, text, unitTextPos, textColor); 
    5052                if (unitHealthGreenRectangle.Width > 0) 
    5153                    renderer.SpriteBatch.Draw(renderer.RegisteredSpriteSheets[Resources.SPRITESHEET_HEALTH].SheetTexture, unitHealthPos, unitHealthGreenRectangle, Color.White, 0.0F, Vector2.Zero, SCALE, SpriteEffects.None, 0); 
     
    5961        private const string ICON_WOOD = "#"; 
    6062        private const string KING_TEXT = "KING HEALTH: "; 
     63        private const string KING_ENEMY_TEXT = "ENEMY KING HEALTH: "; 
    6164        private const string STORE_TEXT = "STORE HEALTH: "; 
    6265        private const string ARMORY_TEXT = "ARMORY HEALTH: "; 
     
    7174        private Vector2 itemStatsPos; 
    7275 
    73         private HealthMeter kingHealthMeter, storeHealthMeter, armoryHealthMeter; 
     76        private HealthMeter kingHealthMeter, storeHealthMeter, armoryHealthMeter, enemyKingHealth; 
    7477 
    7578        public GuiPlayer(GuiManager manager, Player player) 
     
    8285            itemStatsPos = new Vector2(0, Game.HEIGHT - GUI_BAR_HEIGHT + 5); 
    8386 
    84             kingHealthMeter = new HealthMeter(player.King, new Vector2(Game.WIDTH - HEALTH_BAR_WIDTH * SCALE - 10, Game.HEIGHT - GUI_BAR_HEIGHT + 20), KING_TEXT); 
    85             storeHealthMeter = new HealthMeter(player.Store, new Vector2(Game.WIDTH - HEALTH_BAR_WIDTH * SCALE - 10, Game.HEIGHT - GUI_BAR_HEIGHT + 40), STORE_TEXT); 
    86             armoryHealthMeter = new HealthMeter(player.Armory, new Vector2(Game.WIDTH - HEALTH_BAR_WIDTH * SCALE - 10, Game.HEIGHT - GUI_BAR_HEIGHT + 60), ARMORY_TEXT); 
     87            kingHealthMeter = new HealthMeter(player.King, new Vector2(Game.WIDTH - HEALTH_BAR_WIDTH * SCALE - 10, Game.HEIGHT - GUI_BAR_HEIGHT + 20), KING_TEXT, Color.White); 
     88            enemyKingHealth = new HealthMeter(Game.GetEnemyPlayer(player).King, new Vector2(Game.WIDTH - HEALTH_BAR_WIDTH * SCALE - 10, Game.HEIGHT - GUI_BAR_HEIGHT + 40), KING_ENEMY_TEXT, new Color(160, 0, 0)); 
     89            storeHealthMeter = new HealthMeter(player.Store, new Vector2(Game.WIDTH - HEALTH_BAR_WIDTH * SCALE - 10, Game.HEIGHT - GUI_BAR_HEIGHT + 60), STORE_TEXT, Color.White); 
     90            armoryHealthMeter = new HealthMeter(player.Armory, new Vector2(Game.WIDTH - HEALTH_BAR_WIDTH * SCALE - 10, Game.HEIGHT - GUI_BAR_HEIGHT + 80), ARMORY_TEXT, Color.White); 
    8791        } 
    8892 
     
    104108            storeHealthMeter.Update(); 
    105109            armoryHealthMeter.Update(); 
     110            enemyKingHealth.Update(); 
    106111        } 
    107112 
     
    112117 
    113118            kingHealthMeter.Render(renderer); 
    114  
    115119            storeHealthMeter.Render(renderer); 
    116  
    117120            armoryHealthMeter.Render(renderer); 
     121            enemyKingHealth.Render(renderer); 
    118122        } 
    119123    } 
Note: See TracChangeset for help on using the changeset viewer.