diff options
| author | aldrikboy <aldrikboy@gmail.com> | 2017-12-23 19:14:34 +0100 |
|---|---|---|
| committer | aldrikboy <aldrikboy@gmail.com> | 2017-12-23 19:14:34 +0100 |
| commit | ad0d29bf5d881ab619a90ffb8a1f3352eba21615 (patch) | |
| tree | c69fe6ea7212f2d839ca52e3adb523b27dc532b9 /Penguloon/Enemies/EnemyBase.cs | |
| parent | 1276593bfbbfcdbac24b48cf8b574da25945d763 (diff) | |
Communism
Diffstat (limited to 'Penguloon/Enemies/EnemyBase.cs')
| -rw-r--r-- | Penguloon/Enemies/EnemyBase.cs | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/Penguloon/Enemies/EnemyBase.cs b/Penguloon/Enemies/EnemyBase.cs index c67e3bc..9bb6230 100644 --- a/Penguloon/Enemies/EnemyBase.cs +++ b/Penguloon/Enemies/EnemyBase.cs @@ -26,6 +26,9 @@ namespace Penguloon.Enemies public int HealthToTake { get; set; } + public bool Dead { get; set; } = false; + public DateTime PopDate { get; set; } + public EnemyBase(Map map) { this.Map = map; @@ -36,6 +39,14 @@ namespace Penguloon.Enemies public void Update(float deltaTime) { + if (Dead) + { + if((DateTime.Now - PopDate).TotalMilliseconds > (100 / Map.Level.ParentScene.Speed)) + Map.Enemies.Remove(this); + return; + + } + int margin = 5; Box = new Rectangle(new Point((int)Position.X + margin, (int)Position.Y + margin), new Point(Map.TileWidth - (margin * 2), Map.TileHeight - (margin * 2))); @@ -90,7 +101,11 @@ namespace Penguloon.Enemies SpawnChild(); if (Health <= 0) - Map.Enemies.Remove(this); + { + Dead = true; + PopDate = DateTime.Now; + Texture = ContentManager.GetTexture("Enemies/pop"); + } SoundManager.PlayBalloonPopSound(); } |
