health
This commit is contained in:
@@ -17,7 +17,8 @@ namespace OpenRa.Game
|
|||||||
public readonly UnitInfo unitInfo;
|
public readonly UnitInfo unitInfo;
|
||||||
|
|
||||||
public int2 Location;
|
public int2 Location;
|
||||||
public Player Owner;
|
public Player Owner;
|
||||||
|
public int Health;
|
||||||
|
|
||||||
public Actor( string name, int2 location, Player owner )
|
public Actor( string name, int2 location, Player owner )
|
||||||
{
|
{
|
||||||
@@ -25,6 +26,7 @@ namespace OpenRa.Game
|
|||||||
Location = location;
|
Location = location;
|
||||||
CenterLocation = new float2( 12, 12 ) + Game.CellSize * (float2)Location;
|
CenterLocation = new float2( 12, 12 ) + Game.CellSize * (float2)Location;
|
||||||
Owner = owner;
|
Owner = owner;
|
||||||
|
Health = unitInfo.Strength; /* todo: handle cases where this is not true! */
|
||||||
|
|
||||||
if( unitInfo.Traits != null )
|
if( unitInfo.Traits != null )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ namespace OpenRa.Game.Graphics
|
|||||||
|
|
||||||
var selection = Game.controller.orderGenerator as UnitOrderGenerator;
|
var selection = Game.controller.orderGenerator as UnitOrderGenerator;
|
||||||
if (selection != null)
|
if (selection != null)
|
||||||
foreach( var a in Game.world.Actors.Intersect(selection.selection) ) /* make sure we don't grab actors that are dead */
|
foreach( var a in Game.world.Actors.Intersect(selection.selection) )
|
||||||
DrawSelectionBox(a, Color.White, true);
|
DrawSelectionBox(a, Color.White, true);
|
||||||
|
|
||||||
lineRenderer.Flush();
|
lineRenderer.Flush();
|
||||||
@@ -114,7 +114,7 @@ namespace OpenRa.Game.Graphics
|
|||||||
lineRenderer.DrawLine(xy + new float2(0, -2), xy + new float2(0, -4), c, c);
|
lineRenderer.DrawLine(xy + new float2(0, -2), xy + new float2(0, -4), c, c);
|
||||||
lineRenderer.DrawLine(Xy + new float2(0, -2), Xy + new float2(0, -4), c, c);
|
lineRenderer.DrawLine(Xy + new float2(0, -2), Xy + new float2(0, -4), c, c);
|
||||||
|
|
||||||
var healthAmount = 0.6f;
|
var healthAmount = (float)selectedUnit.Health / selectedUnit.unitInfo.Strength;
|
||||||
var healthColor = (healthAmount < conditionRed) ? Color.Red
|
var healthColor = (healthAmount < conditionRed) ? Color.Red
|
||||||
: (healthAmount < conditionYellow) ? Color.Yellow
|
: (healthAmount < conditionYellow) ? Color.Yellow
|
||||||
: Color.LimeGreen;
|
: Color.LimeGreen;
|
||||||
|
|||||||
Reference in New Issue
Block a user