z offsets

This commit is contained in:
Chris Forbes
2009-12-22 19:13:30 +13:00
parent 3c1ead59fd
commit 3bc97ac0b9
21 changed files with 134 additions and 83 deletions

View File

@@ -10,11 +10,14 @@ namespace OpenRa.Game.Traits
{
public WithShadow(Actor self) {}
public IEnumerable<Tuple<Sprite, float2, int>> ModifyRender(Actor self, IEnumerable<Tuple<Sprite, float2, int>> r)
public IEnumerable<Renderable> ModifyRender(Actor self, IEnumerable<Renderable> 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 ));
var shadowSprites = r.Select(a => a.WithPalette(8));
var flyingSprites = (unit.Altitude <= 0) ? r
: r.Select(a => a.WithPos(a.Pos - new float2(0, unit.Altitude)).WithZOffset(3));
return shadowSprites.Concat(flyingSprites);
}
}