factored out flying unit render into WithShadow:IRenderModifier
This commit is contained in:
21
OpenRa.Game/Traits/WithShadow.cs
Normal file
21
OpenRa.Game/Traits/WithShadow.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user