Pass WorldRenderer to AnimationWithOffset.OffsetFunc.

This commit is contained in:
Paul Chote
2013-03-31 19:56:11 +13:00
parent 7c21459b48
commit 2f80cd5f92
12 changed files with 16 additions and 16 deletions

View File

@@ -16,7 +16,7 @@ namespace OpenRA.Graphics
public class AnimationWithOffset
{
public Animation Animation;
public Func<float2> OffsetFunc;
public Func<WorldRenderer, float2> OffsetFunc;
public Func<bool> DisableFunc;
public int ZOffset;
@@ -25,18 +25,18 @@ namespace OpenRA.Graphics
{
}
public AnimationWithOffset(Animation a, Func<float2> o, Func<bool> d)
public AnimationWithOffset(Animation a, Func<WorldRenderer, float2> o, Func<bool> d)
{
this.Animation = a;
this.OffsetFunc = o;
this.DisableFunc = d;
}
public Renderable Image(Actor self, PaletteReference pal)
public Renderable Image(Actor self, WorldRenderer wr, PaletteReference pal)
{
var p = self.CenterLocation;
var loc = p.ToFloat2() - 0.5f * Animation.Image.size
+ (OffsetFunc != null ? OffsetFunc() : float2.Zero);
+ (OffsetFunc != null ? OffsetFunc(wr) : float2.Zero);
var r = new Renderable(Animation.Image, loc, pal, p.Y);
return ZOffset != 0 ? r.WithZOffset(ZOffset) : r;