factored out flying unit render into WithShadow:IRenderModifier

This commit is contained in:
Chris Forbes
2009-12-21 18:13:52 +13:00
parent 994266d95f
commit dbe962364b
7 changed files with 33 additions and 61 deletions

View File

@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OpenRa.Game.Graphics;
namespace OpenRa.Game.Traits
{
class WithShadow : IRenderModifier
{
public WithShadow(Actor self) {}
public IEnumerable<Tuple<Sprite, float2, int>> ModifyRender(Actor self, IEnumerable<Tuple<Sprite, float2, int>> r)
{
var unit = self.traits.Get<Unit>();
var shadowSprites = r.Select( a => Tuple.New( a.a, a.b, 8 ));
var flyingSprites = r.Select( a => Tuple.New( a.a, a.b - new float2( 0, unit.Altitude ), a.c ));
return shadowSprites.Concat(flyingSprites);
}
}
}