using System; using System.Collections.Generic; using System.Linq; using System.Text; using OpenRa.Game.Graphics; namespace OpenRa.Game.Traits { class WithShadowInfo : StatelessTraitInfo {} class WithShadow : IRenderModifier { public IEnumerable ModifyRender(Actor self, IEnumerable r) { var unit = self.traits.Get(); var shadowSprites = r.Select(a => a.WithPalette(PaletteType.Shadow)); var flyingSprites = (unit.Altitude <= 0) ? r : r.Select(a => a.WithPos(a.Pos - new float2(0, unit.Altitude)).WithZOffset(3)); return shadowSprites.Concat(flyingSprites); } } }