adjusted bounds to take altitude into account
This commit is contained in:
@@ -102,6 +102,11 @@ namespace OpenRa.Game
|
|||||||
{
|
{
|
||||||
var size = SelectedSize;
|
var size = SelectedSize;
|
||||||
var loc = CenterLocation - 0.5f * size;
|
var loc = CenterLocation - 0.5f * size;
|
||||||
|
var unit = traits.GetOrDefault<Unit>();
|
||||||
|
|
||||||
|
if (unit != null)
|
||||||
|
loc -= new float2(0, unit.Altitude);
|
||||||
|
|
||||||
return new RectangleF(loc.X, loc.Y, size.X, size.Y);
|
return new RectangleF(loc.X, loc.Y, size.X, size.Y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -95,13 +95,12 @@ namespace OpenRa.Game.Graphics
|
|||||||
|
|
||||||
public void DrawSelectionBox(Actor selectedUnit, Color c, bool drawHealthBar)
|
public void DrawSelectionBox(Actor selectedUnit, Color c, bool drawHealthBar)
|
||||||
{
|
{
|
||||||
var center = selectedUnit.CenterLocation;
|
var bounds = selectedUnit.Bounds;
|
||||||
var size = selectedUnit.SelectedSize;
|
|
||||||
|
|
||||||
var xy = center - 0.5f * size;
|
var xy = new float2(bounds.Left, bounds.Top);
|
||||||
var XY = center + 0.5f * size;
|
var Xy = new float2(bounds.Right, bounds.Top);
|
||||||
var Xy = new float2(XY.X, xy.Y);
|
var xY = new float2(bounds.Left, bounds.Bottom);
|
||||||
var xY = new float2(xy.X, XY.Y);
|
var XY = new float2(bounds.Right, bounds.Bottom);
|
||||||
|
|
||||||
lineRenderer.DrawLine(xy, xy + new float2(4, 0), c, c);
|
lineRenderer.DrawLine(xy, xy + new float2(4, 0), c, c);
|
||||||
lineRenderer.DrawLine(xy, xy + new float2(0, 4), c, c);
|
lineRenderer.DrawLine(xy, xy + new float2(0, 4), c, c);
|
||||||
@@ -121,7 +120,8 @@ namespace OpenRa.Game.Graphics
|
|||||||
if (selectedUnit.Owner == Game.LocalPlayer)
|
if (selectedUnit.Owner == Game.LocalPlayer)
|
||||||
{
|
{
|
||||||
DrawPips(selectedUnit, xY);
|
DrawPips(selectedUnit, xY);
|
||||||
DrawTags(selectedUnit, new float2(center.X, xy.Y));
|
DrawTags(selectedUnit,
|
||||||
|
new float2(.5f * (bounds.Left + bounds.Right ), xy.Y));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user