Support for arbitrary building art offset relative to footprint
This commit is contained in:
@@ -12,20 +12,31 @@ using System;
|
|||||||
using OpenRA.Mods.RA.Effects;
|
using OpenRA.Mods.RA.Effects;
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
using OpenRA.GameRules;
|
using OpenRA.GameRules;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace OpenRA.Mods.RA.Render
|
namespace OpenRA.Mods.RA.Render
|
||||||
{
|
{
|
||||||
public class RenderBuildingInfo : RenderSimpleInfo
|
public class RenderBuildingInfo : RenderSimpleInfo
|
||||||
{
|
{
|
||||||
public readonly bool HasMakeAnimation = true;
|
public readonly bool HasMakeAnimation = true;
|
||||||
|
public readonly float2 Origin = float2.Zero;
|
||||||
public override object Create(ActorInitializer init) { return new RenderBuilding(init);}
|
public override object Create(ActorInitializer init) { return new RenderBuilding(init);}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class RenderBuilding : RenderSimple, INotifyDamage, INotifySold
|
public class RenderBuilding : RenderSimple, INotifyDamage, INotifySold, IRenderModifier
|
||||||
{
|
{
|
||||||
|
readonly float2 Origin;
|
||||||
|
|
||||||
public RenderBuilding( ActorInitializer init )
|
public RenderBuilding( ActorInitializer init )
|
||||||
: this( init, () => 0 )
|
: this( init, () => 0 )
|
||||||
{
|
{
|
||||||
|
Origin = init.self.Info.Traits.Get<RenderBuildingInfo>().Origin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<Renderable> ModifyRender(Actor self, IEnumerable<Renderable> r)
|
||||||
|
{
|
||||||
|
return r.Select(a => a.WithPos(a.Pos - Origin));
|
||||||
}
|
}
|
||||||
|
|
||||||
public RenderBuilding( ActorInitializer init, Func<int> baseFacing )
|
public RenderBuilding( ActorInitializer init, Func<int> baseFacing )
|
||||||
|
|||||||
Reference in New Issue
Block a user