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:
@@ -18,11 +18,11 @@ namespace OpenRA.Mods.Cnc.Effects
|
||||
{
|
||||
public class IonCannon : IEffect
|
||||
{
|
||||
Target target;
|
||||
Animation anim;
|
||||
Player firedBy;
|
||||
string palette;
|
||||
string weapon;
|
||||
readonly Target target;
|
||||
readonly Animation anim;
|
||||
readonly Player firedBy;
|
||||
readonly string palette;
|
||||
readonly string weapon;
|
||||
|
||||
public IonCannon(Player firedBy, string weapon, World world, CPos location, string effect, string palette)
|
||||
{
|
||||
@@ -30,7 +30,7 @@ namespace OpenRA.Mods.Cnc.Effects
|
||||
this.weapon = weapon;
|
||||
this.palette = palette;
|
||||
target = Target.FromCell(location);
|
||||
anim = new Animation(effect);
|
||||
anim = new Animation(world, effect);
|
||||
anim.PlayThen("idle", () => Finish(world));
|
||||
}
|
||||
|
||||
|
||||
@@ -35,19 +35,19 @@ namespace OpenRA.Mods.RA.Render
|
||||
var turret = self.TraitsImplementing<Turreted>()
|
||||
.First(t => t.Name == info.Turret);
|
||||
|
||||
left = new Animation(name, () => turret.turretFacing);
|
||||
left = new Animation(self.World, name, () => turret.turretFacing);
|
||||
left.Play("left");
|
||||
anims.Add("left", new AnimationWithOffset(left, null, () => facing.Facing > 128, 0));
|
||||
|
||||
right = new Animation(name, () => turret.turretFacing);
|
||||
right = new Animation(self.World, name, () => turret.turretFacing);
|
||||
right.Play("right");
|
||||
anims.Add("right", new AnimationWithOffset(right, null, () => facing.Facing <= 128, 0));
|
||||
|
||||
var leftWake = new Animation(name);
|
||||
var leftWake = new Animation(self.World, name);
|
||||
leftWake.Play("wake-left");
|
||||
anims.Add("wake-left", new AnimationWithOffset(leftWake, null, () => facing.Facing > 128, -87));
|
||||
|
||||
var rightWake = new Animation(name);
|
||||
var rightWake = new Animation(self.World, name);
|
||||
rightWake.Play("wake-right");
|
||||
anims.Add("wake-right", new AnimationWithOffset(rightWake, null, () => facing.Facing <= 128, -87));
|
||||
|
||||
|
||||
@@ -72,9 +72,9 @@ namespace OpenRA.Mods.Cnc.Widgets
|
||||
tooltipContainer = Exts.Lazy(() =>
|
||||
Ui.Root.Get<TooltipContainerWidget>(TooltipContainer));
|
||||
|
||||
cantBuild = new Animation("clock");
|
||||
cantBuild = new Animation(world, "clock");
|
||||
cantBuild.PlayFetchIndex("idle", () => 0);
|
||||
clock = new Animation("clock");
|
||||
clock = new Animation(world, "clock");
|
||||
}
|
||||
|
||||
public override void Tick()
|
||||
@@ -183,7 +183,7 @@ namespace OpenRA.Mods.Cnc.Widgets
|
||||
var x = i % Columns;
|
||||
var y = i / Columns;
|
||||
var rect = new Rectangle(rb.X + x * 64 + 1, rb.Y + y * 48 + 1, 64, 48);
|
||||
var icon = new Animation(RenderSimple.GetImage(item));
|
||||
var icon = new Animation(World, RenderSimple.GetImage(item));
|
||||
icon.Play(item.Traits.Get<TooltipInfo>().Icon);
|
||||
var pi = new ProductionIcon()
|
||||
{
|
||||
|
||||
@@ -52,8 +52,8 @@ namespace OpenRA.Mods.Cnc.Widgets
|
||||
tooltipContainer = Exts.Lazy(() =>
|
||||
Ui.Root.Get<TooltipContainerWidget>(TooltipContainer));
|
||||
|
||||
icon = new Animation("icon");
|
||||
clock = new Animation("clock");
|
||||
icon = new Animation(world, "icon");
|
||||
clock = new Animation(world, "clock");
|
||||
}
|
||||
|
||||
public class SupportPowerIcon
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace OpenRA.Mods.Cnc
|
||||
public WithFire(Actor self, WithFireInfo info)
|
||||
{
|
||||
var rs = self.Trait<RenderSprites>();
|
||||
var roof = new Animation(rs.GetImage(self));
|
||||
var roof = new Animation(self.World, rs.GetImage(self));
|
||||
roof.PlayThen("fire-start", () => roof.PlayRepeating("fire-loop"));
|
||||
rs.anims.Add("fire", new AnimationWithOffset(roof, null, null, 1024));
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace OpenRA.Mods.Cnc
|
||||
public WithRoof(Actor self)
|
||||
{
|
||||
var rs = self.Trait<RenderSprites>();
|
||||
var roof = new Animation(rs.GetImage(self), () => self.Trait<IFacing>().Facing);
|
||||
var roof = new Animation(self.World, rs.GetImage(self), () => self.Trait<IFacing>().Facing);
|
||||
roof.Play("roof");
|
||||
rs.anims.Add("roof", new AnimationWithOffset(roof, null, null, 1024));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user