fixed #669 -- helicopters bob slightly in flight

This commit is contained in:
Chris Forbes
2011-10-24 17:04:05 +13:00
parent f5807f5f3b
commit 35b0231746

View File

@@ -8,9 +8,11 @@
*/
#endregion
using System;
using System.Collections.Generic;
using System.Linq;
using OpenRA.Traits;
using OpenRA.Mods.RA.Air;
namespace OpenRA.Mods.RA.Render
{
@@ -22,9 +24,13 @@ namespace OpenRA.Mods.RA.Render
{
var move = self.Trait<IMove>();
/* rude hack */
var visualOffset = (move is Helicopter && move.Altitude > 0)
? Math.Abs((self.ActorID + Game.LocalTick) / 5 % 4 - 1) - 1 : 0;
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));
: r.Select(a => a.WithPos(a.Pos - new float2(0, move.Altitude + visualOffset)).WithZOffset(move.Altitude));
return shadowSprites.Concat(flyingSprites);
}