Kill RenderUnitRotor in favour of RenderUnit + WithRotor.

This commit is contained in:
Paul Chote
2011-03-23 08:05:09 +13:00
parent c7e2619a98
commit 3071cd8240
8 changed files with 76 additions and 83 deletions

View File

@@ -0,0 +1,32 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
*/
#endregion
using System.Collections.Generic;
using System.Linq;
using OpenRA.Traits;
namespace OpenRA.Mods.RA.Render
{
class WithShadowInfo : TraitInfo<WithShadow> {}
class WithShadow : IRenderModifier
{
public IEnumerable<Renderable> ModifyRender(Actor self, IEnumerable<Renderable> r)
{
var move = self.Trait<IMove>();
var shadowSprites = r.Select(a => a.WithPalette("shadow"));
var flyingSprites = (move.Altitude <= 0) ? r
: r.Select(a => a.WithPos(a.Pos - new float2(0, move.Altitude)).WithZOffset(move.Altitude));
return shadowSprites.Concat(flyingSprites);
}
}
}