diff --git a/DepthsBelow/DepthsBelow/Camera.cs b/DepthsBelow/DepthsBelow/Camera.cs
index bd187f4..80850aa 100644
--- a/DepthsBelow/DepthsBelow/Camera.cs
+++ b/DepthsBelow/DepthsBelow/Camera.cs
@@ -35,11 +35,27 @@ namespace DepthsBelow
return Vector2.Transform(screenPos, Matrix.Invert(Transform));
}
+ public Rectangle ScreenToWorld(Rectangle screenRectangle)
+ {
+ var pos = ScreenToWorld(new Vector2(screenRectangle.X, screenRectangle.Y));
+ screenRectangle.X = (int)pos.X;
+ screenRectangle.Y = (int)pos.Y;
+ return screenRectangle;
+ }
+
public Vector2 WorldToScreen(Vector2 worldPos)
{
return Vector2.Transform(worldPos, Transform);
}
+ public Rectangle WorldToScreen(Rectangle screenRectangle)
+ {
+ var pos = WorldToScreen(new Vector2(screenRectangle.X, screenRectangle.Y));
+ screenRectangle.X = (int)pos.X;
+ screenRectangle.Y = (int)pos.Y;
+ return screenRectangle;
+ }
+
public void Update(GameTime gameTime)
{
float elapsed = gameTime.ElapsedGameTime.Milliseconds / 1000.0f;
@@ -85,6 +101,11 @@ namespace DepthsBelow
Transform *= Matrix.CreateTranslation(new Vector3(change.X, change.Y, 0));
}
+ Transform = Matrix.Identity
+ * Matrix.CreateRotationZ(Rotation)
+ * Matrix.CreateScale(Zoom)
+ * Matrix.CreateTranslation(new Vector3(Position.X, Position.Y, 0));
+
lastMouseState = ms;
}
}
diff --git a/DepthsBelow/DepthsBelow/Component/Stat.cs b/DepthsBelow/DepthsBelow/Component/Stat.cs
index dc1afa3..9fb5e45 100644
--- a/DepthsBelow/DepthsBelow/Component/Stat.cs
+++ b/DepthsBelow/DepthsBelow/Component/Stat.cs
@@ -5,9 +5,28 @@ using System.Text;
namespace DepthsBelow.Component
{
- public class Stat : Component
- {
- protected int hp = 0;
+ public class Stat : Component
+ {
+ ///
+ /// The current health points of the unit
+ ///
+ public float HP = 0;
+ public float _MaxHP = 100;
+ ///
+ /// Gets or sets the max HP.
+ ///
+ public float MaxHP
+ {
+ get { return _MaxHP; }
+ set
+ {
+ _MaxHP = value;
+ if (HP == 0)
+ HP = value;
+ }
+ }
+
+ protected int hp = 0;
protected int defence = 0;
protected int stepsTaken = 0;
protected int distanceToTarget = 0;
@@ -65,7 +84,8 @@ namespace DepthsBelow.Component
return panic + GetPenalty(stepsTaken) + (int)(GetPenalty(distance) / 2);
}
- public Stat(Entity parent) : base (parent)
+ public Stat(Entity parent)
+ : base (parent)
{
}
diff --git a/DepthsBelow/DepthsBelow/Core.cs b/DepthsBelow/DepthsBelow/Core.cs
index 27e7292..2c64b2e 100755
--- a/DepthsBelow/DepthsBelow/Core.cs
+++ b/DepthsBelow/DepthsBelow/Core.cs
@@ -32,7 +32,8 @@ namespace DepthsBelow
public static MouseInput MouseInput;
public static KeyboardInput KeyboardInput;
- public List Squad;
+ public List Squad;
+ public DynamicGroupManager GroupManager;
public List Swarm;
public List Volley;
public static Map Map;
@@ -42,20 +43,16 @@ namespace DepthsBelow
public Core()
{
GraphicsDeviceManager = new GraphicsDeviceManager(this);
- Content.RootDirectory = "Content";
-
GraphicsDeviceManager.PreferredBackBufferWidth = 1280;
GraphicsDeviceManager.PreferredBackBufferHeight = 720;
GraphicsDeviceManager.IsFullScreen = false;
-
//graphics.SynchronizeWithVerticalRetrace = false;
- this.IsFixedTimeStep = false;
GraphicsDeviceManager.ApplyChanges();
+ this.IsFixedTimeStep = false;
this.IsMouseVisible = true;
- GameServices.AddService(GraphicsDevice);
- GameServices.AddService(Content);
+ Content.RootDirectory = "Content";
}
///
@@ -66,19 +63,21 @@ namespace DepthsBelow
///
protected override void Initialize()
{
- Lua = new Lua();
-
- // TODO: Add your initialization logic here
- EntityManager = new EntityManager();
- TurnManager = new TurnManager(new string[] { "Player", "Computer" });
-
+ GameServices.AddService(GraphicsDevice);
+ GameServices.AddService(Content);
+
+ Lua = new Lua();
+
+ EntityManager = new EntityManager();
+ TurnManager = new TurnManager(new string[] { "Player", "Computer" });
+
Camera = new Camera(this);
- Interface = new Interface(this);
-
- Squad = new List();
- Swarm = new List();
- Volley = new List();
-
+ Interface = new Interface(this);
+
+ Squad = new List();
+ Swarm = new List();
+ Volley = new List();
+
base.Initialize();
}
@@ -94,6 +93,8 @@ namespace DepthsBelow
Map = Content.Load