HitChance displayed, Stats Rearranged
This commit is contained in:
@@ -33,7 +33,7 @@ namespace DepthsBelow
|
|||||||
public Camera Camera;
|
public Camera Camera;
|
||||||
public Interface Interface;
|
public Interface Interface;
|
||||||
|
|
||||||
public static MouseInput MouseInput;
|
public/* static*/ MouseInput MouseInput;
|
||||||
public static KeyboardInput KeyboardInput;
|
public static KeyboardInput KeyboardInput;
|
||||||
public List<Soldier> Squad;
|
public List<Soldier> Squad;
|
||||||
public DynamicGroupManager GroupManager;
|
public DynamicGroupManager GroupManager;
|
||||||
|
|||||||
@@ -30,6 +30,8 @@ namespace DepthsBelow
|
|||||||
private bool checkingDirection;
|
private bool checkingDirection;
|
||||||
private Vector2 directionStart;
|
private Vector2 directionStart;
|
||||||
|
|
||||||
|
GUI.Text hitChance;
|
||||||
|
|
||||||
public Interface(Core core)
|
public Interface(Core core)
|
||||||
{
|
{
|
||||||
this.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);
|
var button = new GUI.Button(UIParent);
|
||||||
button.SetTexture("images/Enter");
|
button.SetTexture("images/Enter");
|
||||||
button.X = 200;
|
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();
|
UpdateUnitFrames();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ namespace DepthsBelow
|
|||||||
MouseState lastMouseState;
|
MouseState lastMouseState;
|
||||||
Rectangle selectionRectangle;
|
Rectangle selectionRectangle;
|
||||||
Texture2D selectionTexture;
|
Texture2D selectionTexture;
|
||||||
Rectangle gridRectangle;
|
public Rectangle gridRectangle;
|
||||||
Texture2D gridTexture;
|
Texture2D gridTexture;
|
||||||
|
|
||||||
Vector2 directionStart;
|
Vector2 directionStart;
|
||||||
|
|||||||
@@ -53,9 +53,9 @@ namespace DepthsBelow
|
|||||||
|
|
||||||
var stat = new Component.Stat(this)
|
var stat = new Component.Stat(this)
|
||||||
{
|
{
|
||||||
Life = 2,
|
Life = 50,
|
||||||
Defence = 2,
|
Defence = 25,
|
||||||
Strength = 5000,
|
Strength = 26,
|
||||||
GetAim = 100,
|
GetAim = 100,
|
||||||
GetDodge = 50
|
GetDodge = 50
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user