/// <summary> /// Creates a new Living Entity /// </summary> /// <param name="rect">The rectangle that represents the location and width and height of the entity</param> /// <param name="fileName">the location of the sprite for this entity</param> public LivingEntity(FloatRectangle rect, Sprite sprite, int health, AI.AI ai = null, int cash = 0) : base(rect, sprite) { inventory = new Inventory(); time = new GameTime(); lastShot = 60000D; interactRange = 32; // the below depend on texture, this should not be needed ever but because of the player texture it is... //this.interactBoundsOffsetY = interactBoundsOffsetY; //this.interactBoundsOffsetX = interactBoundsOffsetX; this.cash = cash; this.health = health; this.ai = ai; maxHealth = health; color = Color.Red; healthBar = new ProgressBar(new Vector2(60, 20)); healthBar.MaxValue = maxHealth; healthBar.CurrentValue = health; healthBar.IncludeText = Name; healthBar.LoadVisuals(Game1.Instance.Content, Game1.Instance.GraphicsDevice); controls.Add(healthBar); }
public WeaponInfoUI() { // Properties for this class this.Alignment = ControlAlignment.Left; this.Size = new Vector2(180, 100); // Init other things. // Holds weapon and ammo info Container weaponAmmoContainer = new Container(); weaponAmmoContainer.Size = new Vector2(this.Size.X - 10, this.Size.Y - 10); weaponAmmoContainer.Alignment = ControlAlignment.Center; //weaponAmmoContainer.parent = this; Add(weaponAmmoContainer); // Holds weapon img and name Container weaponImgInfoContainer = new Container(); weaponImgInfoContainer.Size = new Vector2(100, 90); //weaponImgInfoContainer.Border = new BorderInfo(Sprites.guiSpritesDictionary["circle_border"]); //weaponImgInfoContainer.parent = weaponAmmoContainer; weaponAmmoContainer.Add(weaponImgInfoContainer); // Weapon image weaponImageContainer = new Container(); weaponImageContainer.Fill = null; //weaponImageContainer.Border = new BorderInfo(Sprites.guiSpritesDictionary["circle_border"]); weaponImageContainer.Size = new Vector2(64, 64); weaponImageContainer.Location = new Vector2(0, -5); weaponImageContainer.Alignment = ControlAlignment.Center; //weaponImageContainer.parent = weaponImgInfoContainer; weaponImgInfoContainer.Add(weaponImageContainer); // Weapon name weaponNameLbl = new Label(); weaponNameLbl.Location = new Vector2(0, 35); //weaponNameLbl.Text = ""; weaponNameLbl.Alignment = ControlAlignment.Center; //weaponNameLbl.parent = weaponImgInfoContainer; weaponImgInfoContainer.Add(weaponNameLbl); // Ammo container Container ammoInfoContainer = new Container(); ammoInfoContainer.Size = new Vector2(75, 90); ammoInfoContainer.Alignment = ControlAlignment.Right; //ammoInfoContainer.parent = weaponAmmoContainer; weaponAmmoContainer.Add(ammoInfoContainer); // Ammo top ammoCurrentInClipLbl = new Label(); ammoCurrentInClipLbl.Location = new Vector2(0, -20); ammoCurrentInClipLbl.Text = ""; ammoCurrentInClipLbl.Alignment = ControlAlignment.Center; //ammoCurrentInClipLbl.parent = ammoInfoContainer; ammoInfoContainer.Add(ammoCurrentInClipLbl); // Ammo divider reloadBar = new ProgressBar(new Vector2(75, 10)); reloadBar.ProgressColor = Color.Black; reloadBar.MaxValue = 100; reloadBar.CurrentValue = 0; reloadBar.IncludeText = String.Empty; reloadBar.Alignment = ControlAlignment.Center; //reloadBar.parent = ammoInfoContainer; ammoInfoContainer.Add(reloadBar); isReloadingLbl = new Label(); isReloadingLbl.Scale = .5f; isReloadingLbl.Alignment = ControlAlignment.Center; isReloadingLbl.Text = ""; //isReloadingLbl.parent = reloadBar; reloadBar.Add(isReloadingLbl); /* Container ammoDivisorContainer = new Container(); ammoDivisorContainer.Size = new Vector2(75, 10); ammoDivisorContainer.Location = new Vector2(0, 0); ammoDivisorContainer.Alignment = ControlAlignment.Center; ammoDivisorContainer.parent = ammoInfoContainer; ammoInfoContainer.Add(ammoDivisorContainer); */ // Ammo bottom ammoTotalLbl = new Label(); ammoTotalLbl.Location = new Vector2(0, 20); ammoTotalLbl.Text = ""; ammoTotalLbl.Alignment = ControlAlignment.Center; //ammoTotalLbl.parent = ammoInfoContainer; ammoInfoContainer.Add(ammoTotalLbl); }
public LivingEntityInfoUI() { // Properties for this class this.Alignment = ControlAlignment.Right; this.Size = new Vector2(180, 80); this.Location = new Vector2(0, RenderManager.ViewportHeight - 80); // Holds health label and current health label Container healthInfoContainer = new Container(); healthInfoContainer.Size = new Vector2(this.Size.X - 20, 30); healthInfoContainer.Location = new Vector2(0, -15); healthInfoContainer.Alignment = ControlAlignment.Center; //healthInfoContainer.parent = this; Add(healthInfoContainer); Container healthTxtLblContainer = new Container(); healthTxtLblContainer.Size = new Vector2(50, 30); healthTxtLblContainer.Alignment = ControlAlignment.Left; //healthTxtLblContainer.parent = healthInfoContainer; healthInfoContainer.Add(healthTxtLblContainer); Label healthTxtLbl = new Label(); healthTxtLbl.AutoResize = true; healthTxtLbl.Text = "Health:"; healthTxtLbl.Alignment = ControlAlignment.Center; //healthTxtLbl.parent = healthTxtLblContainer; healthTxtLblContainer.Add(healthTxtLbl); Container healthLblContainer = new Container(); healthLblContainer.Size = new Vector2(80, 30); healthLblContainer.Alignment = ControlAlignment.Right; //healthLblContainer.parent = healthInfoContainer; healthInfoContainer.Add(healthLblContainer); /* healthLbl = new Label(); healthLbl.AutoResize = true; healthLbl.Text = ""; healthLbl.Alignment = ControlAlignment.Center; healthLbl.parent = healthLblContainer; healthLblContainer.Add(healthLbl); */ healthBar = new ProgressBar(healthLblContainer.Size); healthBar.Size = healthLblContainer.Size; healthBar.Alignment = ControlAlignment.Center; healthBar.ProgressColor = Color.Green; healthBar.MaxValue = 4; //healthBar.parent = healthLblContainer; healthLblContainer.Add(healthBar); // Holds money label and current money label Container moneyInfoContainer = new Container(); moneyInfoContainer.Location = new Vector2(0, 15); moneyInfoContainer.Size = new Vector2(this.Size.X - 20, 30); moneyInfoContainer.Alignment = ControlAlignment.Center; Container moneyTxtLblContainer = new Container(); moneyTxtLblContainer.Size = new Vector2(50, 30); moneyTxtLblContainer.Alignment = ControlAlignment.Left; //moneyTxtLblContainer.parent = moneyInfoContainer; moneyInfoContainer.Add(moneyTxtLblContainer); Label moneyTxtLbl = new Label(); moneyTxtLbl.AutoResize = true; moneyTxtLbl.Text = "Money:"; moneyTxtLbl.Alignment = ControlAlignment.Center; //moneyTxtLbl.parent = moneyTxtLblContainer; moneyTxtLblContainer.Add(moneyTxtLbl); Container moneyLblContainer = new Container(); moneyLblContainer.Size = new Vector2(80, 30); moneyLblContainer.Alignment = ControlAlignment.Right; //moneyLblContainer.parent = moneyInfoContainer; moneyInfoContainer.Add(moneyLblContainer); moneyLbl = new Label(); moneyLbl.AutoResize = true; moneyLbl.Text = "$00000000"; moneyLbl.Alignment = ControlAlignment.Center; //moneyLbl.parent = moneyLblContainer; moneyLblContainer.Add(moneyLbl); //moneyInfoContainer.parent = this; Add(moneyInfoContainer); }