Implemented trait defined Rollovers.

This commit is contained in:
Andre Mohren
2018-11-06 19:47:51 +01:00
committed by Paul Chote
parent 7049f68fbd
commit 42446ac9ba
3 changed files with 14 additions and 8 deletions

View File

@@ -34,7 +34,7 @@ namespace OpenRA.Mods.Common.Traits.Render
public object Create(ActorInitializer init) { return new SelectionDecorations(init.Self, this); }
}
public class SelectionDecorations : IRenderAboveShroud, INotifyCreated, ITick
public class SelectionDecorations : ISelectionDecorations, IRenderAboveShroud, INotifyCreated, ITick
{
// depends on the order of pips in TraitsInterfaces.cs!
static readonly string[] PipStrings = { "pip-empty", "pip-green", "pip-yellow", "pip-red", "pip-gray", "pip-blue", "pip-ammo", "pip-ammoempty" };
@@ -121,6 +121,12 @@ namespace OpenRA.Mods.Common.Traits.Render
yield return r;
}
public void DrawRollover(Actor self, WorldRenderer worldRenderer)
{
var bounds = decorationBounds.FirstNonEmptyBounds(self, worldRenderer);
new SelectionBarsRenderable(self, bounds, true, true).Render(worldRenderer);
}
IEnumerable<IRenderable> DrawPips(Actor self, Rectangle bounds, WorldRenderer wr)
{
if (pipSources.Length == 0)