fix #1056
This commit is contained in:
@@ -34,6 +34,13 @@ namespace OpenRA.Traits
|
|||||||
{
|
{
|
||||||
public Dictionary<string, AnimationWithOffset> anims = new Dictionary<string, AnimationWithOffset>();
|
public Dictionary<string, AnimationWithOffset> anims = new Dictionary<string, AnimationWithOffset>();
|
||||||
|
|
||||||
|
public static Func<int> MakeFacingFunc(Actor self)
|
||||||
|
{
|
||||||
|
var facing = self.TraitOrDefault<IFacing>();
|
||||||
|
if (facing == null) return () => 0;
|
||||||
|
return () => facing.Facing;
|
||||||
|
}
|
||||||
|
|
||||||
public Animation anim
|
public Animation anim
|
||||||
{
|
{
|
||||||
get { return anims[""].Animation; }
|
get { return anims[""].Animation; }
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ namespace OpenRA.Mods.RA.Render
|
|||||||
RenderInfantryInfo Info;
|
RenderInfantryInfo Info;
|
||||||
string idleSequence;
|
string idleSequence;
|
||||||
int idleDelay;
|
int idleDelay;
|
||||||
|
Mobile mobile;
|
||||||
|
|
||||||
protected virtual string NormalizeInfantrySequence(Actor self, string baseSequence)
|
protected virtual string NormalizeInfantrySequence(Actor self, string baseSequence)
|
||||||
{
|
{
|
||||||
@@ -53,9 +54,9 @@ namespace OpenRA.Mods.RA.Render
|
|||||||
}
|
}
|
||||||
|
|
||||||
public AnimationState State { get; private set; }
|
public AnimationState State { get; private set; }
|
||||||
Mobile mobile;
|
|
||||||
public RenderInfantry(Actor self, RenderInfantryInfo info)
|
public RenderInfantry(Actor self, RenderInfantryInfo info)
|
||||||
: base(self, () => self.Trait<IFacing>().Facing)
|
: base(self, RenderSimple.MakeFacingFunc(self))
|
||||||
{
|
{
|
||||||
Info = info;
|
Info = info;
|
||||||
anim.PlayFetchIndex(NormalizeInfantrySequence(self, "stand"), () => 0);
|
anim.PlayFetchIndex(NormalizeInfantrySequence(self, "stand"), () => 0);
|
||||||
|
|||||||
@@ -21,15 +21,8 @@ namespace OpenRA.Mods.RA.Render
|
|||||||
|
|
||||||
public class RenderUnit : RenderSimple
|
public class RenderUnit : RenderSimple
|
||||||
{
|
{
|
||||||
static Func<int> MakeFacingFunc(Actor self)
|
|
||||||
{
|
|
||||||
var facing = self.TraitOrDefault<IFacing>();
|
|
||||||
if (facing == null) return () => 0;
|
|
||||||
return () => facing.Facing;
|
|
||||||
}
|
|
||||||
|
|
||||||
public RenderUnit(Actor self)
|
public RenderUnit(Actor self)
|
||||||
: base(self, MakeFacingFunc(self))
|
: base(self, RenderSimple.MakeFacingFunc(self))
|
||||||
{
|
{
|
||||||
anim.PlayRepeating("idle");
|
anim.PlayRepeating("idle");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user