Extend WithSpriteBody funtionality
Move building placement range circle to PlaceBuilding, add PauseAnimationWhenDisabled.
This commit is contained in:
@@ -8,15 +8,17 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Effects;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Primitives;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
[Desc("Allows the player to execute build orders.", " Attach this to the player actor.")]
|
||||
public class PlaceBuildingInfo : ITraitInfo
|
||||
public class PlaceBuildingInfo : ITraitInfo, IPlaceBuildingDecoration
|
||||
{
|
||||
[Desc("Palette to use for rendering the placement sprite.")]
|
||||
[PaletteReference] public readonly string Palette = "terrain";
|
||||
@@ -28,6 +30,16 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public readonly string NewOptionsNotification = "NewOptions";
|
||||
|
||||
public object Create(ActorInitializer init) { return new PlaceBuilding(this); }
|
||||
|
||||
public IEnumerable<IRenderable> Render(WorldRenderer wr, World w, ActorInfo ai, WPos centerPosition)
|
||||
{
|
||||
if (!ai.Traits.Get<BuildingInfo>().RequiresBaseProvider)
|
||||
yield break;
|
||||
|
||||
foreach (var a in w.ActorsWithTrait<BaseProvider>())
|
||||
foreach (var r in a.Trait.RenderAfterWorld(wr))
|
||||
yield return r;
|
||||
}
|
||||
}
|
||||
|
||||
public class PlaceBuilding : IResolveOrder
|
||||
|
||||
Reference in New Issue
Block a user