Change animations to use the proper SequenceProvider
Remove references to the global "Game" and use the SequenceProvider of the current world/map.
This commit is contained in:
@@ -19,9 +19,9 @@ namespace OpenRA.Traits
|
||||
{
|
||||
public override object Create(ActorInitializer init) { return new RenderSimple(init.self); }
|
||||
|
||||
public virtual IEnumerable<IRenderable> RenderPreview(ActorInfo ai, PaletteReference pr)
|
||||
public virtual IEnumerable<IRenderable> RenderPreview(World world, ActorInfo ai, PaletteReference pr)
|
||||
{
|
||||
var anim = new Animation(RenderSimple.GetImage(ai), () => 0);
|
||||
var anim = new Animation(world, RenderSimple.GetImage(ai), () => 0);
|
||||
anim.PlayRepeating("idle");
|
||||
|
||||
return anim.Render(WPos.Zero, WVec.Zero, 0, pr, Scale);
|
||||
@@ -35,7 +35,7 @@ namespace OpenRA.Traits
|
||||
public RenderSimple(Actor self, Func<int> baseFacing)
|
||||
: base(self)
|
||||
{
|
||||
anims.Add("", new Animation(GetImage(self), baseFacing));
|
||||
anims.Add("", new Animation(self.World, GetImage(self), baseFacing));
|
||||
Info = self.Info.Traits.Get<RenderSimpleInfo>();
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace OpenRA.Traits
|
||||
var group = self.World.Selection.GetControlGroupForActor(self);
|
||||
if (group == null) return;
|
||||
|
||||
var pipImages = new Animation("pips");
|
||||
var pipImages = new Animation(self.World, "pips");
|
||||
var pal = wr.Palette(Info.Palette);
|
||||
pipImages.PlayFetchIndex("groups", () => (int)group);
|
||||
pipImages.Tick();
|
||||
@@ -75,7 +75,7 @@ namespace OpenRA.Traits
|
||||
if (!pipSources.Any())
|
||||
return;
|
||||
|
||||
var pipImages = new Animation("pips");
|
||||
var pipImages = new Animation(self.World, "pips");
|
||||
pipImages.PlayRepeating(pipStrings[0]);
|
||||
|
||||
var pipSize = pipImages.Image.size.ToInt2();
|
||||
@@ -115,7 +115,7 @@ namespace OpenRA.Traits
|
||||
if (!self.Owner.IsAlliedWith(self.World.RenderPlayer))
|
||||
return;
|
||||
|
||||
var tagImages = new Animation("pips");
|
||||
var tagImages = new Animation(self.World, "pips");
|
||||
var pal = wr.Palette(Info.Palette);
|
||||
var tagxyOffset = new int2(0, 6);
|
||||
var tagBase = wr.Viewport.WorldToViewPx(basePosition);
|
||||
|
||||
Reference in New Issue
Block a user