document the various overlay and animation change traits

This commit is contained in:
Matthias Mailänder
2014-07-01 17:46:15 +02:00
parent cf7bd75dad
commit 6097b3eb19
25 changed files with 104 additions and 34 deletions

View File

@@ -13,8 +13,12 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Cnc
{
[Desc("Renders a flame sprite on top of the actor.")]
class WithFireInfo : ITraitInfo, Requires<RenderSpritesInfo>
{
public readonly string StartSequence = "fire-start";
public readonly string LoopSequence = "fire-loop";
public object Create(ActorInitializer init) { return new WithFire(init.self, this); }
}
@@ -23,9 +27,9 @@ namespace OpenRA.Mods.Cnc
public WithFire(Actor self, WithFireInfo info)
{
var rs = self.Trait<RenderSprites>();
var roof = new Animation(self.World, rs.GetImage(self));
roof.PlayThen("fire-start", () => roof.PlayRepeating("fire-loop"));
rs.Add("fire", new AnimationWithOffset(roof, null, null, 1024));
var fire = new Animation(self.World, rs.GetImage(self));
fire.PlayThen(info.StartSequence, () => fire.PlayRepeating(info.LoopSequence));
rs.Add("fire", new AnimationWithOffset(fire, null, null, 1024));
}
}
}