Remove work-around for aircraft from WithMoveAnimation
This commit is contained in:
@@ -27,24 +27,16 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
readonly IMove movement;
|
readonly IMove movement;
|
||||||
readonly WithSpriteBody wsb;
|
readonly WithSpriteBody wsb;
|
||||||
|
|
||||||
WPos cachedPosition;
|
|
||||||
|
|
||||||
public WithMoveAnimation(ActorInitializer init, WithMoveAnimationInfo info)
|
public WithMoveAnimation(ActorInitializer init, WithMoveAnimationInfo info)
|
||||||
{
|
{
|
||||||
this.info = info;
|
this.info = info;
|
||||||
movement = init.Self.Trait<IMove>();
|
movement = init.Self.Trait<IMove>();
|
||||||
wsb = init.Self.Trait<WithSpriteBody>();
|
wsb = init.Self.Trait<WithSpriteBody>();
|
||||||
|
|
||||||
cachedPosition = init.Self.CenterPosition;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Tick(Actor self)
|
public void Tick(Actor self)
|
||||||
{
|
{
|
||||||
var oldCachedPosition = cachedPosition;
|
var isMoving = movement.IsMoving && !self.IsDead;
|
||||||
cachedPosition = self.CenterPosition;
|
|
||||||
|
|
||||||
// Flying units set IsMoving whenever they are airborne, which isn't enough for our purposes
|
|
||||||
var isMoving = movement.IsMoving && !self.IsDead && (oldCachedPosition - cachedPosition).HorizontalLengthSquared != 0;
|
|
||||||
if (isMoving ^ (wsb.DefaultAnimation.CurrentSequence.Name != info.MoveSequence))
|
if (isMoving ^ (wsb.DefaultAnimation.CurrentSequence.Name != info.MoveSequence))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user