render control group overlay
This commit is contained in:
@@ -15,7 +15,6 @@ namespace OpenRa.Game.Graphics
|
||||
public readonly TerrainRenderer terrainRenderer;
|
||||
public readonly SpriteRenderer spriteRenderer;
|
||||
public readonly LineRenderer lineRenderer;
|
||||
//public readonly Region region;
|
||||
public readonly UiOverlay uiOverlay;
|
||||
readonly Renderer renderer;
|
||||
|
||||
@@ -115,6 +114,7 @@ namespace OpenRa.Game.Graphics
|
||||
if (drawHealthBar)
|
||||
{
|
||||
DrawHealthBar(selectedUnit, xy, Xy);
|
||||
DrawControlGroup(selectedUnit, xy);
|
||||
|
||||
// Only display pips and tags to the owner
|
||||
if (selectedUnit.Owner == Game.LocalPlayer)
|
||||
@@ -176,6 +176,17 @@ namespace OpenRa.Game.Graphics
|
||||
static readonly string[] pipStrings = { "pip-empty", "pip-green", "pip-yellow", "pip-red", "pip-gray" };
|
||||
static readonly string[] tagStrings = { "", "tag-fake", "tag-primary" };
|
||||
|
||||
void DrawControlGroup(Actor selectedUnit, float2 basePosition)
|
||||
{
|
||||
var group = Game.controller.GetControlGroupForActor(selectedUnit);
|
||||
if (group == null) return;
|
||||
|
||||
var pipImages = new Animation("pips");
|
||||
pipImages.PlayFetchIndex("groups", () => (int)group);
|
||||
pipImages.Tick();
|
||||
spriteRenderer.DrawSprite(pipImages.Image, basePosition + new float2(-8, 1), 0);
|
||||
}
|
||||
|
||||
void DrawPips(Actor selectedUnit, float2 basePosition)
|
||||
{
|
||||
// If a mod wants to implement a unit with multiple pip sources, then they are placed on multiple rows
|
||||
|
||||
Reference in New Issue
Block a user