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; Actor a;
Animation anim = new Animation("crate-effects"); 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) public CrateEffect(Actor a, string seq)
{ {
@@ -46,7 +52,7 @@ namespace OpenRA.Mods.RA.Effects
public IEnumerable<Renderable> Render() public IEnumerable<Renderable> Render()
{ {
yield return new Renderable(anim.Image, 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; Experience += amount;
while (Level < Levels.Count() - 1 && Experience > Levels[Level]) while (Level < Levels.Count() - 1 && Experience >= Levels[Level])
{ {
Level++; Level++;
// TODO: Show an effect or play a sound or something // Game.Debug("{0} became Level {1}".F(self.Info.Name, Level));
Log.Write("{0} became Level {1}".F(self.Info.Name, Level));
self.World.AddFrameEndTask(w => Sound.PlayToPlayer(self.Owner, "hydrod1.aud", self.CenterLocation);
{ self.World.AddFrameEndTask(w => w.Add(new CrateEffect(self, "levelup", new int2(0,-24))));
w.Add(new CrateEffect(self, "speed"));
});
} }
} }

BIN
mods/ra/levelup.shp Normal file

Binary file not shown.

View File

@@ -844,6 +844,7 @@
<sequence name="armor" start="0" length="23" src="armor" /> <sequence name="armor" start="0" length="23" src="armor" />
<sequence name="chrono" start="0" length="25" src="chronbox" /> <sequence name="chrono" start="0" length="25" src="chronbox" />
<sequence name="airstrike" start="0" length="9" src="deviator" /> <sequence name="airstrike" start="0" length="9" src="deviator" />
<sequence name="levelup" start="0" length="5" src="levelup" tick="200" />
</unit> </unit>
<unit name="parach"> <unit name="parach">
<sequence name="open" start="0" length="5" /> <sequence name="open" start="0" length="5" />