summaryrefslogtreecommitdiff
path: root/Penguloon/Objects/ObjectBase.cs
diff options
context:
space:
mode:
authoraldrikboy <aldrikboy@gmail.com>2017-12-29 17:27:49 +0100
committeraldrikboy <aldrikboy@gmail.com>2017-12-29 17:27:49 +0100
commitda38e93e55b6ff46a53dcd9d2be393149089d329 (patch)
treec19fdb964ee6f8dd8dd3102b22de541828850983 /Penguloon/Objects/ObjectBase.cs
parent5373e919a0d9e389fc2076963f610d044c21ccb5 (diff)
obejct info, new level selector, credits haHA
Diffstat (limited to 'Penguloon/Objects/ObjectBase.cs')
-rw-r--r--Penguloon/Objects/ObjectBase.cs28
1 files changed, 27 insertions, 1 deletions
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<ProjectileBase> Projectiles { get; set; } = new List<ProjectileBase>();
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,