Unhardcode, lint-test and self-document the ion cannon sequence.
This commit is contained in:
@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Cnc.Effects
|
|||||||
int weaponDelay;
|
int weaponDelay;
|
||||||
bool impacted = false;
|
bool impacted = false;
|
||||||
|
|
||||||
public IonCannon(Player firedBy, WeaponInfo weapon, World world, CPos location, string effect, string palette, int delay)
|
public IonCannon(Player firedBy, WeaponInfo weapon, World world, CPos location, string effect, string sequence, string palette, int delay)
|
||||||
{
|
{
|
||||||
this.firedBy = firedBy;
|
this.firedBy = firedBy;
|
||||||
this.weapon = weapon;
|
this.weapon = weapon;
|
||||||
@@ -37,7 +37,7 @@ namespace OpenRA.Mods.Cnc.Effects
|
|||||||
weaponDelay = delay;
|
weaponDelay = delay;
|
||||||
target = Target.FromCell(world, location);
|
target = Target.FromCell(world, location);
|
||||||
anim = new Animation(world, effect);
|
anim = new Animation(world, effect);
|
||||||
anim.PlayThen("idle", () => Finish(world));
|
anim.PlayThen(sequence, () => Finish(world));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Tick(World world)
|
public void Tick(World world)
|
||||||
|
|||||||
@@ -27,8 +27,12 @@ namespace OpenRA.Mods.Cnc.Traits
|
|||||||
[Desc("Amount of time to keep the camera alive")]
|
[Desc("Amount of time to keep the camera alive")]
|
||||||
public readonly int CameraRemoveDelay = 25;
|
public readonly int CameraRemoveDelay = 25;
|
||||||
|
|
||||||
[Desc("Effect sequence to display")]
|
[Desc("Effect sequence sprite image")]
|
||||||
public readonly string Effect = "ionsfx";
|
public readonly string Effect = "ionsfx";
|
||||||
|
|
||||||
|
[Desc("Effect sequence to display")]
|
||||||
|
[SequenceReference("Effect")] public readonly string EffectSequence = "idle";
|
||||||
|
|
||||||
[PaletteReference] public readonly string EffectPalette = "effect";
|
[PaletteReference] public readonly string EffectPalette = "effect";
|
||||||
|
|
||||||
[Desc("Which weapon to fire"), WeaponReference]
|
[Desc("Which weapon to fire"), WeaponReference]
|
||||||
@@ -60,7 +64,7 @@ namespace OpenRA.Mods.Cnc.Traits
|
|||||||
self.World.AddFrameEndTask(w =>
|
self.World.AddFrameEndTask(w =>
|
||||||
{
|
{
|
||||||
Game.Sound.Play(Info.LaunchSound, self.World.Map.CenterOfCell(order.TargetLocation));
|
Game.Sound.Play(Info.LaunchSound, self.World.Map.CenterOfCell(order.TargetLocation));
|
||||||
w.Add(new IonCannon(self.Owner, info.WeaponInfo, w, order.TargetLocation, info.Effect, info.EffectPalette, info.WeaponDelay));
|
w.Add(new IonCannon(self.Owner, info.WeaponInfo, w, order.TargetLocation, info.Effect, info.EffectSequence, info.EffectPalette, info.WeaponDelay));
|
||||||
|
|
||||||
if (info.CameraActor == null)
|
if (info.CameraActor == null)
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user