Add terrain height support to WithShadow.

This commit is contained in:
Paul Chote
2016-02-20 15:31:36 +00:00
parent 16a3eb4d2c
commit 04c40eddfe

View File

@@ -35,11 +35,12 @@ namespace OpenRA.Mods.Common.Traits
public IEnumerable<IRenderable> ModifyRender(Actor self, WorldRenderer wr, IEnumerable<IRenderable> r)
{
// Contrails shouldn't cast shadows
var height = self.World.Map.DistanceAboveTerrain(self.CenterPosition).Length;
var shadowSprites = r.Where(s => !s.IsDecoration)
.Select(a => a.WithPalette(wr.Palette(info.Palette))
.OffsetBy(new WVec(0, 0, -a.Pos.Z))
.WithZOffset(a.ZOffset + a.Pos.Z)
.AsDecoration());
.OffsetBy(new WVec(0, 0, -height))
.WithZOffset(a.ZOffset + height)
.AsDecoration());
return shadowSprites.Concat(r);
}