prone while not moving fix
This commit is contained in:
@@ -26,8 +26,7 @@ namespace OpenRa.Game.Traits
|
|||||||
if (float2.WithinEpsilon(self.CenterLocation, Util.CenterOfCell(mobile.toCell), 2)) return false;
|
if (float2.WithinEpsilon(self.CenterLocation, Util.CenterOfCell(mobile.toCell), 2)) return false;
|
||||||
var dir = Util.QuantizeFacing(self.traits.Get<Unit>().Facing, 8);
|
var dir = Util.QuantizeFacing(self.traits.Get<Unit>().Facing, 8);
|
||||||
|
|
||||||
var takeCover = self.traits.GetOrDefault<TakeCover>();
|
var prefix = IsProne(self) ? "crawl-" : "run-";
|
||||||
var prefix = (takeCover != null && takeCover.IsProne) ? "crawl-" : "run-";
|
|
||||||
|
|
||||||
if (anim.CurrentSequence.Name.StartsWith(prefix))
|
if (anim.CurrentSequence.Name.StartsWith(prefix))
|
||||||
anim.ReplaceAnim(prefix + dir);
|
anim.ReplaceAnim(prefix + dir);
|
||||||
@@ -38,14 +37,18 @@ namespace OpenRa.Game.Traits
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool inAttack = false;
|
bool inAttack = false;
|
||||||
|
bool IsProne(Actor self)
|
||||||
|
{
|
||||||
|
var takeCover = self.traits.GetOrDefault<TakeCover>();
|
||||||
|
return takeCover != null && takeCover.IsProne;
|
||||||
|
}
|
||||||
|
|
||||||
public void Attacking(Actor self)
|
public void Attacking(Actor self)
|
||||||
{
|
{
|
||||||
var dir = Util.QuantizeFacing(self.traits.Get<Unit>().Facing, 8);
|
var dir = Util.QuantizeFacing(self.traits.Get<Unit>().Facing, 8);
|
||||||
inAttack = true;
|
inAttack = true;
|
||||||
|
|
||||||
var takeCover = self.traits.GetOrDefault<TakeCover>();
|
var prefix = IsProne(self) ? "prone-shoot-" : "shoot-";
|
||||||
var prefix = (takeCover != null && takeCover.IsProne) ? "prone-shoot-" : "shoot-";
|
|
||||||
|
|
||||||
anim.PlayThen(prefix + dir, () => inAttack = false);
|
anim.PlayThen(prefix + dir, () => inAttack = false);
|
||||||
}
|
}
|
||||||
@@ -58,8 +61,13 @@ namespace OpenRa.Game.Traits
|
|||||||
|
|
||||||
/* todo: idle anims, etc */
|
/* todo: idle anims, etc */
|
||||||
|
|
||||||
anim.PlayFacing("stand",
|
var dir = Util.QuantizeFacing(self.traits.Get<Unit>().Facing, 8);
|
||||||
() => self.traits.Get<Unit>().Facing);
|
|
||||||
|
if (IsProne(self))
|
||||||
|
anim.PlayFetchIndex("crawl-" + dir, () => 0); /* what a hack. */
|
||||||
|
else
|
||||||
|
anim.PlayFacing("stand",
|
||||||
|
() => self.traits.Get<Unit>().Facing);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override IEnumerable<Tuple<Sprite, float2, int>> Render(Actor self)
|
public override IEnumerable<Tuple<Sprite, float2, int>> Render(Actor self)
|
||||||
|
|||||||
Reference in New Issue
Block a user