Merge branch 'master' of github.com:sippeangelo/DepthsBelow

Conflicts:
	DepthsBelow/DepthsBelow/KeyboardInput.cs
	DepthsBelow/DepthsBelow/SmallEnemy.cs
This commit is contained in:
Simon Holmberg
2012-10-30 23:40:24 +00:00
8 changed files with 1171 additions and 1120 deletions
+1 -1
View File
@@ -32,7 +32,7 @@ namespace DepthsBelow
public Camera Camera;
public Interface Interface;
public static MouseInput MouseInput;
public/* static*/ MouseInput MouseInput;
public static KeyboardInput KeyboardInput;
public List<Soldier> Squad;
public DynamicGroupManager GroupManager;
+39 -3
View File
@@ -30,6 +30,8 @@ namespace DepthsBelow
private bool checkingDirection;
private Vector2 directionStart;
GUI.Text hitChance;
public Interface(Core core)
{
this.core = core;
@@ -259,6 +261,10 @@ namespace DepthsBelow
}
};
hitChance = new Text(UIParent);
hitChance.SetFont("Arial");
hitChance.Value = "";
var button = new GUI.Button(UIParent);
button.SetTexture("images/Enter");
button.X = 200;
@@ -533,9 +539,9 @@ namespace DepthsBelow
frame.Y = lastFrame.Y + lastFrame.Height;
// Update HP
//var healthBarBg = (GUI.Frame)frame["healthBarBg"];
//var healthBar = (GUI.Frame)frame["healthBar"];
//healthBar.Width = (int)((healthBarBg.Width - 2) * (soldier.GetComponent<Component.Stat>().HP / soldier.GetComponent<Component.Stat>().MaxHP));
var healthBarBg = (GUI.Frame)frame["healthBarBg"];
var healthBar = (GUI.Frame)frame["healthBar"];
healthBar.Width = (int)((healthBarBg.Width - 2) * (soldier.GetComponent<Component.Stat>().Life / soldier.GetComponent<Component.Stat>().MaxHP));
lastFrame = frame;
}
@@ -575,6 +581,36 @@ namespace DepthsBelow
}
}
bool onSomething = false;
foreach (var unit in core.Squad)
{
if (unit.Selected == true && unit.Fired == false)
{
foreach (var enemy in core.Swarm)
{
if (core.MouseInput.gridRectangle.Intersects(enemy.GetComponent<Component.Collision>().Rectangle))
{
onSomething = true;
hitChance.Visible = true;
int chanceToHit = Utility.CalculateHitChance(unit.GetComponent<Component.Stat>(), unit.GetComponent<Component.Transform>().World.Position, enemy);
hitChance.Value = chanceToHit.ToString() + "%";
hitChance.X = ms.X - 15;
hitChance.Y = ms.Y - 15;
break;
}
}
if (onSomething == true)
{
break;
}
}
}
if (onSomething == false)
{
hitChance.Visible = false;
}
UpdateUnitFrames();
}
}
+1
View File
@@ -152,6 +152,7 @@ namespace DepthsBelow
foreach (var enemy in core.Swarm)
{
enemy.step = 0;
enemy.AttackedThisTurn = false;
Point target = Point.Zero;
float distance = 7000;
foreach (var unit in core.Squad)
+3 -2
View File
@@ -11,7 +11,8 @@ namespace DepthsBelow
{
//EntityManager entityManager;
int wakingDistance = 6;
int wakingDistance = 7;
int sleepingDistance = 6;
List<SmallEnemy> swarm;
@@ -33,7 +34,7 @@ namespace DepthsBelow
this.GetComponent<Component.Transform>().Grid.Position.Y);
Vector2 distance2 = new Vector2(entity.GetComponent<Component.Transform>().Grid.Position.X,
entity.GetComponent<Component.Transform>().Grid.Position.Y);
if (Vector2.Distance(distance1, distance2) < wakingDistance)
if (Vector2.Distance(distance1, distance2) < wakingDistance/* && Vector2.Distance(distance1, distance2) > sleepingDistance*/)
{
var enemy = new SmallEnemy(ref swarm);
enemy.X = this.X;
+1 -1
View File
@@ -17,7 +17,7 @@ namespace DepthsBelow
MouseState lastMouseState;
Rectangle selectionRectangle;
Texture2D selectionTexture;
Rectangle gridRectangle;
public Rectangle gridRectangle;
Texture2D gridTexture;
Vector2 directionStart;
+9 -3
View File
@@ -22,6 +22,8 @@ namespace DepthsBelow
public int numberOfSteps = 5;
public int currentStep = 0;
public bool AttackedThisTurn = false;
public int step
{
get { return currentStep; }
@@ -54,9 +56,9 @@ namespace DepthsBelow
var stat = new Component.Stat(this)
{
Life = 2,
Defence = 2,
Strength = 5000,
Life = 50,
Defence = 25,
Strength = 26,
GetAim = 100,
GetDodge = 50
};
@@ -156,9 +158,12 @@ namespace DepthsBelow
if (entity is Soldier)
{
if (entity.GetComponent<Component.Collision>().Rectangle.Intersects(this.GetComponent<Component.Collision>().Rectangle))
{
if (AttackedThisTurn == false)
{
if (Utility.AttackTest(this.GetComponent<Component.Stat>(), entity, Utility.CalculateHitChance(this.GetComponent<Component.Stat>(), this.Transform.World.Position, entity)))
{
AttackedThisTurn = true;
break;
}
}
@@ -166,6 +171,7 @@ namespace DepthsBelow
}
}
}
}
}
}
+2 -2
View File
@@ -78,8 +78,8 @@ namespace DepthsBelow
{
MaxHP = 100,
MaxPanic = 100,
//Life = 10,
Defence = 10,
Life = 100,
Defence = 25,
Strength = 50,
GetAim = 40,
GetDodge = 20
@@ -29,6 +29,13 @@
<object type="SquadStart" gid="4" x="384" y="352"/>
<object type="MonsterSpawn" gid="5" x="544" y="480"/>
<object type="MonsterSpawn" gid="5" x="768" y="608"/>
<object type="MonsterSpawn" gid="5" x="768" y="576"/>
<object type="MonsterSpawn" gid="5" x="672" y="288"/>
<object type="MonsterSpawn" gid="5" x="704" y="832"/>
<object type="MonsterSpawn" gid="5" x="864" y="832"/>
<object type="MonsterSpawn" gid="5" x="576" y="896"/>
<object type="MonsterSpawn" gid="5" x="448" y="576"/>
<object type="MonsterSpawn" gid="5" x="560" y="670"/>
</objectgroup>
<layer name="Collision" width="100" height="100">
<data encoding="base64" compression="zlib">