Adjust GetImage plumbing in preparation for race-specific sequences.

This commit is contained in:
Paul Chote
2014-07-09 18:44:25 +12:00
committed by Paul Chote
parent 4c3a95ebc0
commit 00a2146299
18 changed files with 62 additions and 48 deletions

View File

@@ -40,7 +40,7 @@ namespace OpenRA.Traits
return new WRot(WAngle.Zero, WAngle.Zero, WAngle.FromFacing(facing));
}
public object Create(ActorInitializer init) { return new BodyOrientation(init.Self, this); }
public object Create(ActorInitializer init) { return new BodyOrientation(init, this); }
}
public class BodyOrientation : IBodyOrientation
@@ -50,9 +50,11 @@ namespace OpenRA.Traits
[Sync] public int QuantizedFacings { get { return quantizedFacings.Value; } }
public BodyOrientation(Actor self, BodyOrientationInfo info)
public BodyOrientation(ActorInitializer init, BodyOrientationInfo info)
{
this.info = info;
var self = init.Self;
var race = init.Contains<RaceInit>() ? init.Get<RaceInit, string>() : self.Owner.Country.Race;
quantizedFacings = Exts.Lazy(() =>
{
@@ -64,7 +66,7 @@ namespace OpenRA.Traits
if (qboi == null)
throw new InvalidOperationException("Actor type '" + self.Info.Name + "' does not define a quantized body orientation.");
return qboi.QuantizedBodyFacings(self.World.Map.SequenceProvider, self.Info);
return qboi.QuantizedBodyFacings(self.Info, self.World.Map.SequenceProvider, race);
});
}