using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Penguloon.Levels; using Penguloon.Projectiles; using System.Collections.Generic; 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"); this.TileSpanX = 2; this.TileSpanY = 1; this.Range = Map.TileWidth * 1f; 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) { this.Texture = ContentManager.GetTexture("Objects/healthRegenerator"); this.TileSpanX = 2; this.TileSpanY = 1; this.Range = Map.TileWidth * 1f; 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(); DrawText = true; TextToDraw = "+ " + HealthToRegenerate.ToString(); PosY = Position.Y; PosX = Position.X + ((Map.TileWidth * TileSpanX) / 2); Map.Level.Health += HealthToRegenerate; } public override void SpawnUnique() { } } }