Fix moonwalking infantry

This commit is contained in:
Paul Chote
2010-11-30 14:17:39 +13:00
parent eb8682fd0e
commit 2e7b5e8712
2 changed files with 22 additions and 11 deletions

View File

@@ -27,7 +27,8 @@ namespace OpenRA.Mods.RA.Render
{
Idle,
Attacking,
Moving
Moving,
Waiting
};
public AnimationState State { get; private set; }
@@ -52,11 +53,14 @@ namespace OpenRA.Mods.RA.Render
{
base.Tick(self);
if (State == AnimationState.Attacking || self.IsIdle || !mobile.IsMoving)
return;
// Set move animation
if (State != AnimationState.Moving)
// If path is blocked, we can have !isMoving and !idle
// Need to handle this case specially
if (!mobile.IsMoving && State == AnimationState.Moving)
{
State = AnimationState.Waiting;
anim.Play("stand");
}
else if (State != AnimationState.Moving && mobile.IsMoving)
{
State = AnimationState.Moving;
anim.PlayRepeating("run");