Fix moonwalking infantry
This commit is contained in:
@@ -27,7 +27,8 @@ namespace OpenRA.Mods.RA.Render
|
|||||||
{
|
{
|
||||||
Idle,
|
Idle,
|
||||||
Attacking,
|
Attacking,
|
||||||
Moving
|
Moving,
|
||||||
|
Waiting
|
||||||
};
|
};
|
||||||
|
|
||||||
public AnimationState State { get; private set; }
|
public AnimationState State { get; private set; }
|
||||||
@@ -52,11 +53,14 @@ namespace OpenRA.Mods.RA.Render
|
|||||||
{
|
{
|
||||||
base.Tick(self);
|
base.Tick(self);
|
||||||
|
|
||||||
if (State == AnimationState.Attacking || self.IsIdle || !mobile.IsMoving)
|
// If path is blocked, we can have !isMoving and !idle
|
||||||
return;
|
// Need to handle this case specially
|
||||||
|
if (!mobile.IsMoving && State == AnimationState.Moving)
|
||||||
// Set move animation
|
{
|
||||||
if (State != AnimationState.Moving)
|
State = AnimationState.Waiting;
|
||||||
|
anim.Play("stand");
|
||||||
|
}
|
||||||
|
else if (State != AnimationState.Moving && mobile.IsMoving)
|
||||||
{
|
{
|
||||||
State = AnimationState.Moving;
|
State = AnimationState.Moving;
|
||||||
anim.PlayRepeating("run");
|
anim.PlayRepeating("run");
|
||||||
|
|||||||
@@ -45,11 +45,18 @@ namespace OpenRA.Mods.RA
|
|||||||
remainingProneTime--;
|
remainingProneTime--;
|
||||||
|
|
||||||
var ri = self.Trait<RenderInfantry>();
|
var ri = self.Trait<RenderInfantry>();
|
||||||
if (ri.State == RenderInfantry.AnimationState.Idle)
|
|
||||||
if (IsProne)
|
// Mobile.IsMoving isn't set to true until after the first move tick
|
||||||
ri.anim.PlayFetchIndex("crawl", () => 0);
|
// so we need a hack here to prevent a single frame of stand state
|
||||||
else
|
|
||||||
ri.anim.Play("stand");
|
if (IsProne && (ri.State == RenderInfantry.AnimationState.Idle ||
|
||||||
|
ri.State == RenderInfantry.AnimationState.Waiting ||
|
||||||
|
ri.anim.CurrentSequence.Name == "stand"))
|
||||||
|
ri.anim.PlayFetchIndex("crawl", () => 0);
|
||||||
|
else if (!IsProne && (ri.State == RenderInfantry.AnimationState.Idle ||
|
||||||
|
ri.State == RenderInfantry.AnimationState.Waiting ||
|
||||||
|
ri.anim.CurrentSequence.Name == "stand"))
|
||||||
|
ri.anim.Play("stand");
|
||||||
|
|
||||||
if (ri.anim.CurrentSequence.Name == "run" && IsProne)
|
if (ri.anim.CurrentSequence.Name == "run" && IsProne)
|
||||||
ri.anim.ReplaceAnim("crawl");
|
ri.anim.ReplaceAnim("crawl");
|
||||||
|
|||||||
Reference in New Issue
Block a user