Allow Animation to generate its own Renderables.

This commit is contained in:
Paul Chote
2013-07-15 19:21:18 +12:00
parent fc458d191d
commit 15688eed13
22 changed files with 70 additions and 51 deletions

View File

@@ -9,6 +9,7 @@
#endregion
using System;
using System.Collections.Generic;
using OpenRA.Traits;
namespace OpenRA.Graphics
@@ -34,19 +35,14 @@ namespace OpenRA.Graphics
this.ZOffset = zOffset;
}
public IRenderable Image(Actor self, WorldRenderer wr, PaletteReference pal)
{
return Image(self, wr, pal, 1f);
}
public IRenderable Image(Actor self, WorldRenderer wr, PaletteReference pal, float scale)
public IEnumerable<IRenderable> Render(Actor self, WorldRenderer wr, PaletteReference pal, float scale)
{
var p = self.CenterPosition;
if (OffsetFunc != null)
p += OffsetFunc();
var z = (ZOffset != null) ? ZOffset(p) : 0;
return new SpriteRenderable(Animation.Image, p, z, pal, scale);
return Animation.Render(p, z, pal, scale);
}
public static implicit operator AnimationWithOffset(Animation a)