Remove CrateEffect in favor of using updated SpriteEffect

This commit is contained in:
reaperrr
2018-10-07 17:55:06 +02:00
committed by Paul Chote
parent 4de0d0fcb9
commit eb86160021
15 changed files with 102 additions and 74 deletions

View File

@@ -20,8 +20,11 @@ namespace OpenRA.Mods.Common.Traits
[Desc("Chance of getting this crate, assuming the collector is compatible.")]
public readonly int SelectionShares = 10;
[Desc("An animation defined in sequence yaml(s) to draw.")]
public readonly string Effect = null;
[Desc("Image containing the crate effect animation sequence.")]
public readonly string Image = "crate-effects";
[Desc("Animation sequence played when collected. Leave empty for no effect.")]
[SequenceReference("Image")] public readonly string Sequence = null;
[Desc("Palette to draw the animation in.")]
[PaletteReference] public readonly string Palette = "effect";
@@ -84,8 +87,8 @@ namespace OpenRA.Mods.Common.Traits
Game.Sound.PlayNotification(self.World.Map.Rules, collector.Owner, "Speech",
Info.Notification, collector.Owner.Faction.InternalName);
if (Info.Effect != null)
collector.World.AddFrameEndTask(w => w.Add(new CrateEffect(collector, Info.Effect, Info.Palette)));
if (Info.Image != null && Info.Sequence != null)
collector.World.AddFrameEndTask(w => w.Add(new SpriteEffect(collector, w, Info.Image, Info.Sequence, Info.Palette)));
}
}
}

View File

@@ -29,6 +29,12 @@ namespace OpenRA.Mods.Common.Traits
[GrantedConditionReference]
public IEnumerable<string> LinterConditions { get { return Conditions.Values; } }
[Desc("Image for the level up sprite.")]
public readonly string LevelUpImage = null;
[Desc("Sequence for the level up sprite. Needs to be present on Image.")]
[SequenceReference("Image")] public readonly string LevelUpSequence = "levelup";
[Desc("Palette for the level up sprite.")]
[PaletteReference] public readonly string LevelUpPalette = "effect";
@@ -107,7 +113,8 @@ namespace OpenRA.Mods.Common.Traits
if (!silent)
{
Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Sounds", info.LevelUpNotification, self.Owner.Faction.InternalName);
self.World.AddFrameEndTask(w => w.Add(new CrateEffect(self, "levelup", info.LevelUpPalette)));
if (info.LevelUpImage != null && info.LevelUpSequence != null)
self.World.AddFrameEndTask(w => w.Add(new SpriteEffect(self, w, info.LevelUpImage, info.LevelUpSequence, info.LevelUpPalette)));
}
}
}