From c3c4f2c7617c393ad6e8c7f1d87abf4a9a8cf602 Mon Sep 17 00:00:00 2001 From: aldrikboy Date: Mon, 1 Jan 2018 23:49:59 +0100 Subject: bobba --- Penguloon/Objects/HealthGeneratorObject.cs | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'Penguloon/Objects') diff --git a/Penguloon/Objects/HealthGeneratorObject.cs b/Penguloon/Objects/HealthGeneratorObject.cs index 460387c..bce4d78 100644 --- a/Penguloon/Objects/HealthGeneratorObject.cs +++ b/Penguloon/Objects/HealthGeneratorObject.cs @@ -1,4 +1,5 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Penguloon.Levels; using Penguloon.Projectiles; using System.Collections.Generic; @@ -7,6 +8,13 @@ namespace Penguloon.Objects { public class HealthGeneratorObject : ObjectBase { + public int HealthToRegenerate { get; set; } = 15; + public bool DrawText { get; set; } = false; + public SpriteFont Font { get; set; } + public string TextToDraw { get; set; } + public float PosY { get; set; } + public float PosX { get; set; } + public HealthGeneratorObject(Vector2 position, Map map) : base(position, map) { this.Texture = ContentManager.GetTexture("Objects/healthRegenerator"); @@ -16,6 +24,8 @@ namespace Penguloon.Objects this.AttackSpeedMS = 9999999; this.ShouldRotate = false; this.infoText = map.Level.ParentScene.Main.Resources.GetString(Resource.String.ObjectHospital); + + Font = ContentManager.GetFont(StaticUIValues.IngameFont); } public HealthGeneratorObject(Map map) : base(map) @@ -27,23 +37,36 @@ namespace Penguloon.Objects this.AttackSpeedMS = 9999999; this.ShouldRotate = false; this.infoText = map.Level.ParentScene.Main.Resources.GetString(Resource.String.ObjectHospital); + + Font = ContentManager.GetFont(StaticUIValues.IngameFont); } public override void DrawUnique(float deltaTime) { - + if (DrawText) + Map.Level.ParentScene.DrawText(Font, TextToDraw, new Vector2(PosX, PosY), new Vector2(), + TextAllignment.CenterTop, Color.White, + Color.Black, 2); } public override void UpdateUnique(float deltaTime) { + if (DrawText) + PosY -= (25 * deltaTime); + if (Position.Y - PosY > 75) + DrawText = false; } public override void RoundIsFinished() { base.RoundIsFinished(); - Map.Level.Health += 25; + DrawText = true; + TextToDraw = "+ " + HealthToRegenerate.ToString(); + PosY = Position.Y; + PosX = Position.X + ((Map.TileWidth * TileSpanX) / 2); + Map.Level.Health += HealthToRegenerate; } public override void SpawnUnique() -- cgit v1.2.3-70-g09d2