summaryrefslogtreecommitdiff
path: root/Penguloon/Objects
diff options
context:
space:
mode:
Diffstat (limited to 'Penguloon/Objects')
-rw-r--r--Penguloon/Objects/CannonObject.cs2
-rw-r--r--Penguloon/Objects/GoldPenguinObject.cs2
-rw-r--r--Penguloon/Objects/HealthGeneratorObject.cs54
-rw-r--r--Penguloon/Objects/ObjectBase.cs28
-rw-r--r--Penguloon/Objects/PenguinObject.cs2
5 files changed, 87 insertions, 1 deletions
diff --git a/Penguloon/Objects/CannonObject.cs b/Penguloon/Objects/CannonObject.cs
index 916e617..41ed9bf 100644
--- a/Penguloon/Objects/CannonObject.cs
+++ b/Penguloon/Objects/CannonObject.cs
@@ -14,6 +14,7 @@ namespace Penguloon.Objects
this.TileSpanY = 1;
this.Range = Map.TileWidth * 3f;
this.AttackSpeedMS = 2500;
+ this.infoText = map.Level.ParentScene.Main.Resources.GetString(Resource.String.ObjectCannon);
}
public CannonObject(Map map) : base(map)
@@ -23,6 +24,7 @@ namespace Penguloon.Objects
this.TileSpanY = 1;
this.Range = Map.TileWidth * 3f;
this.AttackSpeedMS = 2500;
+ this.infoText = map.Level.ParentScene.Main.Resources.GetString(Resource.String.ObjectCannon);
}
public override void DrawUnique(float deltaTime)
diff --git a/Penguloon/Objects/GoldPenguinObject.cs b/Penguloon/Objects/GoldPenguinObject.cs
index c406e2c..1b15131 100644
--- a/Penguloon/Objects/GoldPenguinObject.cs
+++ b/Penguloon/Objects/GoldPenguinObject.cs
@@ -14,6 +14,7 @@ namespace Penguloon.Objects
this.TileSpanY = 1;
this.Range = Map.TileWidth * 2.5f;
this.AttackSpeedMS = 500;
+ this.infoText = map.Level.ParentScene.Main.Resources.GetString(Resource.String.ObjectGoldPenguin);
}
public GoldPenguinObject(Map map) : base(map)
@@ -23,6 +24,7 @@ namespace Penguloon.Objects
this.TileSpanY = 1;
this.Range = Map.TileWidth * 2.5f;
this.AttackSpeedMS = 500;
+ this.infoText = map.Level.ParentScene.Main.Resources.GetString(Resource.String.ObjectGoldPenguin);
}
public override void DrawUnique(float deltaTime)
diff --git a/Penguloon/Objects/HealthGeneratorObject.cs b/Penguloon/Objects/HealthGeneratorObject.cs
new file mode 100644
index 0000000..460387c
--- /dev/null
+++ b/Penguloon/Objects/HealthGeneratorObject.cs
@@ -0,0 +1,54 @@
+using Microsoft.Xna.Framework;
+using Penguloon.Levels;
+using Penguloon.Projectiles;
+using System.Collections.Generic;
+
+namespace Penguloon.Objects
+{
+ public class HealthGeneratorObject : ObjectBase
+ {
+ 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);
+ }
+
+ 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);
+ }
+
+ public override void DrawUnique(float deltaTime)
+ {
+
+ }
+
+ public override void UpdateUnique(float deltaTime)
+ {
+
+ }
+
+ public override void RoundIsFinished()
+ {
+ base.RoundIsFinished();
+
+ Map.Level.Health += 25;
+ }
+
+ public override void SpawnUnique()
+ {
+
+ }
+ }
+} \ No newline at end of file
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,
diff --git a/Penguloon/Objects/PenguinObject.cs b/Penguloon/Objects/PenguinObject.cs
index abb3c3a..a4fa389 100644
--- a/Penguloon/Objects/PenguinObject.cs
+++ b/Penguloon/Objects/PenguinObject.cs
@@ -14,6 +14,7 @@ namespace Penguloon.Objects
this.TileSpanY = 1;
this.Range = Map.TileWidth * 2;
this.AttackSpeedMS = 1000;
+ this.infoText = map.Level.ParentScene.Main.Resources.GetString(Resource.String.ObjectPenguin);
}
public PenguinObject(Map map) : base(map)
@@ -23,6 +24,7 @@ namespace Penguloon.Objects
this.TileSpanY = 1;
this.Range = Map.TileWidth * 2;
this.AttackSpeedMS = 1000;
+ this.infoText = map.Level.ParentScene.Main.Resources.GetString(Resource.String.ObjectPenguin);
}
public override void DrawUnique(float deltaTime)