From da38e93e55b6ff46a53dcd9d2be393149089d329 Mon Sep 17 00:00:00 2001 From: aldrikboy Date: Fri, 29 Dec 2017 17:27:49 +0100 Subject: obejct info, new level selector, credits haHA --- Penguloon/Objects/ObjectBase.cs | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'Penguloon/Objects/ObjectBase.cs') diff --git a/Penguloon/Objects/ObjectBase.cs b/Penguloon/Objects/ObjectBase.cs index cde206d..9d00702 100644 --- a/Penguloon/Objects/ObjectBase.cs +++ b/Penguloon/Objects/ObjectBase.cs @@ -17,19 +17,23 @@ namespace Penguloon.Objects public Texture2D Texture { get; set; } public Texture2D RangeCircle { get; set; } - public float Rotation { get; set; } + public float Rotation { get; set; } = -0f; public Vector2 Position { get; set; } public Vector2 Center { get; set; } public int TileSpanX { get; set; } public int TileSpanY { get; set; } + public string infoText { get; set; } + public List Projectiles { get; set; } = new List(); public Map Map { get; set; } public Rectangle Box { get; set; } + public bool ShouldRotate { get; set; } = true; + public ObjectBase(Vector2 position, Map map) { this.Map = map; @@ -41,8 +45,20 @@ namespace Penguloon.Objects this.Map = map; } + public bool RoundFinished { get; set; } = true; + public void Update(float deltaTime) { + // round has started + if (Map.WaveManager.RoundActive && RoundFinished) + RoundFinished = false; + + if (!Map.WaveManager.RoundActive && !RoundFinished) + { + RoundFinished = true; + RoundIsFinished(); + } + this.Center = new Vector2(Position.X + ((TileSpanX * Map.TileWidth) / 2), Position.Y + ((TileSpanY * Map.TileHeight) / 2)); // loop from back of list to front so we always focus the balloons in front @@ -50,6 +66,7 @@ namespace Penguloon.Objects { if (Contains(Map.Enemies[i].Box.Center.ToVector2())) { + if(ShouldRotate) Rotation = (float)GetRotation(Map.Enemies[i].Box.Center.ToVector2()); if ((DateTime.Now - LastAttack).TotalMilliseconds > (AttackSpeedMS / (int)Map.Level.ParentScene.Speed)) @@ -69,6 +86,11 @@ namespace Penguloon.Objects RemoveUselessProjectiles(); } + public virtual void RoundIsFinished() + { + + } + private void RemoveUselessProjectiles() { for (int i = 0; i < Projectiles.Count; i++) @@ -110,8 +132,12 @@ namespace Penguloon.Objects if(RangeCircle == null) RangeCircle = CreateCircle((int)Range * 2); + float rot = (float)Rotation + (float)MathHelper.PiOver2; + if (!ShouldRotate) + rot = 0f; + Rectangle rec = new Rectangle( (int)Position.X + ((int)(Map.TileWidth * TileSpanX)) / 2, (int)Position.Y + ((int)(Map.TileHeight * TileSpanY)) / 2, -- cgit v1.2.3-70-g09d2