HitChance displayed, Stats Rearranged

This commit is contained in:
Niklas Ulf Anders Cullberg
2012-10-30 22:04:16 +01:00
parent f2b1b731e5
commit f14623c882
4 changed files with 790 additions and 754 deletions
+1 -1
View File
@@ -33,7 +33,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;
+36
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;
@@ -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 -1
View File
@@ -17,7 +17,7 @@ namespace DepthsBelow
MouseState lastMouseState;
Rectangle selectionRectangle;
Texture2D selectionTexture;
Rectangle gridRectangle;
public Rectangle gridRectangle;
Texture2D gridTexture;
Vector2 directionStart;
+3 -3
View File
@@ -53,9 +53,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
};