Introduce IDecorationBounds to replace Actor.SelectionOverlayBounds.

This commit is contained in:
Paul Chote
2017-12-08 17:31:36 +00:00
committed by reaperrr
parent 6f5d035e79
commit ff5b4b15b3
15 changed files with 148 additions and 64 deletions

View File

@@ -160,8 +160,16 @@ namespace OpenRA.Mods.Cnc.Traits
var targetUnits = power.UnitsInRange(xy).Where(a => !world.FogObscures(a));
foreach (var unit in targetUnits)
{
if (unit.CanBeViewedByPlayer(manager.Self.Owner))
yield return new SelectionBoxRenderable(unit, Color.Red);
{
var bounds = unit.TraitsImplementing<IDecorationBounds>()
.Select(b => b.DecorationBounds(unit, wr))
.FirstOrDefault(b => !b.IsEmpty);
yield return new SelectionBoxRenderable(unit, bounds, Color.Red);
}
}
}
public IEnumerable<IRenderable> Render(WorldRenderer wr, World world)
@@ -270,8 +278,16 @@ namespace OpenRA.Mods.Cnc.Traits
}
foreach (var unit in power.UnitsInRange(sourceLocation))
{
if (unit.CanBeViewedByPlayer(manager.Self.Owner))
yield return new SelectionBoxRenderable(unit, Color.Red);
{
var bounds = unit.TraitsImplementing<IDecorationBounds>()
.Select(b => b.DecorationBounds(unit, wr))
.FirstOrDefault(b => !b.IsEmpty);
yield return new SelectionBoxRenderable(unit, bounds, Color.Red);
}
}
}
public IEnumerable<IRenderable> Render(WorldRenderer wr, World world)