hack CrateEffect to have a custom offset; add levelup.shp; change > to >= in GainsExperience

This commit is contained in:
Chris Forbes
2010-05-27 19:02:07 +12:00
parent 1bd9dc7536
commit 230625897a
4 changed files with 13 additions and 9 deletions

View File

@@ -29,7 +29,13 @@ namespace OpenRA.Mods.RA.Effects
{
Actor a;
Animation anim = new Animation("crate-effects");
float2 doorOffset = new float2(-4,0);
float2 offset = new float2(-4,0);
public CrateEffect(Actor a, string seq, int2 offset)
: this(a, seq)
{
this.offset = offset;
}
public CrateEffect(Actor a, string seq)
{
@@ -46,7 +52,7 @@ namespace OpenRA.Mods.RA.Effects
public IEnumerable<Renderable> Render()
{
yield return new Renderable(anim.Image,
a.CenterLocation - .5f * anim.Image.size + doorOffset, "effect");
a.CenterLocation - .5f * anim.Image.size + offset, "effect");
}
}
}

View File

@@ -58,17 +58,14 @@ namespace OpenRA.Mods.RA
{
Experience += amount;
while (Level < Levels.Count() - 1 && Experience > Levels[Level])
while (Level < Levels.Count() - 1 && Experience >= Levels[Level])
{
Level++;
// TODO: Show an effect or play a sound or something
Log.Write("{0} became Level {1}".F(self.Info.Name, Level));
// Game.Debug("{0} became Level {1}".F(self.Info.Name, Level));
self.World.AddFrameEndTask(w =>
{
w.Add(new CrateEffect(self, "speed"));
});
Sound.PlayToPlayer(self.Owner, "hydrod1.aud", self.CenterLocation);
self.World.AddFrameEndTask(w => w.Add(new CrateEffect(self, "levelup", new int2(0,-24))));
}
}