Change IPostRenderSelection and IPlaceBuildingDecoration to return renderables.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
@@ -8,6 +8,7 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Mods.RA.Graphics;
|
||||
@@ -17,19 +18,20 @@ namespace OpenRA.Mods.RA
|
||||
{
|
||||
class RenderShroudCircleInfo : ITraitInfo, IPlaceBuildingDecoration
|
||||
{
|
||||
public void Render(WorldRenderer wr, World w, ActorInfo ai, WPos centerPosition)
|
||||
public IEnumerable<IRenderable> Render(WorldRenderer wr, World w, ActorInfo ai, WPos centerPosition)
|
||||
{
|
||||
new RangeCircleRenderable(
|
||||
yield return new RangeCircleRenderable(
|
||||
centerPosition,
|
||||
ai.Traits.Get<CreatesShroudInfo>().Range,
|
||||
0,
|
||||
Color.FromArgb(128, Color.Cyan),
|
||||
Color.FromArgb(96, Color.Black)
|
||||
).Render(wr);
|
||||
);
|
||||
|
||||
foreach (var a in w.ActorsWithTrait<RenderShroudCircle>())
|
||||
if (a.Actor.Owner == a.Actor.World.LocalPlayer)
|
||||
a.Trait.RenderAfterWorld(wr);
|
||||
foreach (var r in a.Trait.RenderAfterWorld(wr))
|
||||
yield return r;
|
||||
}
|
||||
|
||||
public object Create(ActorInitializer init) { return new RenderShroudCircle(init.self); }
|
||||
@@ -41,18 +43,18 @@ namespace OpenRA.Mods.RA
|
||||
|
||||
public RenderShroudCircle(Actor self) { this.self = self; }
|
||||
|
||||
public void RenderAfterWorld(WorldRenderer wr)
|
||||
public IEnumerable<IRenderable> RenderAfterWorld(WorldRenderer wr)
|
||||
{
|
||||
if (self.Owner != self.World.LocalPlayer)
|
||||
return;
|
||||
yield break;
|
||||
|
||||
new RangeCircleRenderable(
|
||||
yield return new RangeCircleRenderable(
|
||||
self.CenterPosition,
|
||||
self.Info.Traits.Get<CreatesShroudInfo>().Range,
|
||||
0,
|
||||
Color.FromArgb(128, Color.Cyan),
|
||||
Color.FromArgb(96, Color.Black)
|
||||
).Render(wr);
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user