Allow sequences to define a custom z offset.

This commit is contained in:
Paul Chote
2013-07-15 19:48:17 +12:00
parent 15688eed13
commit 9a47c6a303
2 changed files with 5 additions and 1 deletions

View File

@@ -47,7 +47,7 @@ namespace OpenRA.Graphics
public IEnumerable<IRenderable> Render(WPos pos, int zOffset, PaletteReference palette, float scale)
{
yield return new SpriteRenderable(Image, pos, zOffset, palette, scale);
yield return new SpriteRenderable(Image, pos, CurrentSequence.ZOffset + zOffset, palette, scale);
}
public IEnumerable<IRenderable> Render(WPos pos, PaletteReference palette)

View File

@@ -29,6 +29,7 @@ namespace OpenRA.Graphics
public int Stride { get { return stride; } }
public int Facings { get { return facings; } }
public int Tick { get { return tick; } }
public readonly int ZOffset;
public Sequence(string unit, string name, MiniYaml info)
{
@@ -76,6 +77,9 @@ namespace OpenRA.Graphics
if (d.ContainsKey("Transpose"))
transpose = bool.Parse(d["Transpose"].Value);
if (d.ContainsKey("ZOffset"))
ZOffset = int.Parse(d["ZOffset"].Value);
if (length > stride)
throw new InvalidOperationException(
"{0}: Sequence {1}.{2}: Length must be <= stride"