Added straightforward hover behavior for all units. Give a unit a nonzero Altitude: in its Mobile: block and the WithShadow: trait to make it hover.

This commit is contained in:
unknown
2012-06-17 17:51:25 -05:00
committed by Chris Forbes
parent 7af0e64708
commit 21ab0b461c
3 changed files with 13 additions and 7 deletions

View File

@@ -13,6 +13,7 @@ using System.Collections.Generic;
using System.Linq;
using OpenRA.Traits;
using OpenRA.Mods.RA.Air;
using OpenRA.Mods.RA.Move;
namespace OpenRA.Mods.RA.Render
{
@@ -25,7 +26,7 @@ namespace OpenRA.Mods.RA.Render
var move = self.Trait<IMove>();
/* rude hack */
var visualOffset = (move is Helicopter && move.Altitude > 0)
var visualOffset = ((move is Helicopter || move is Mobile) && move.Altitude > 0)
? Math.Abs((self.ActorID + Game.LocalTick) / 5 % 4 - 1) - 1 : 0;
var shadowSprites = r.Select(a => a.WithPalette("shadow"));