Allow Animation to generate its own Renderables.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user