Combat.DoExplosion now takes a Target

(needs more refactoring)
This commit is contained in:
alzeih
2010-07-22 16:00:14 +12:00
parent 4e22e37192
commit 6be4e5c266
11 changed files with 22 additions and 21 deletions

View File

@@ -18,14 +18,14 @@ namespace OpenRA.Mods.Cnc.Effects
{
class IonCannon : IEffect
{
int2 Target;
Target target;
Animation anim;
Actor firedBy;
public IonCannon(Actor firedBy, World world, int2 location)
{
this.firedBy = firedBy;
Target = location;
target = Target.FromPos(OpenRA.Traits.Util.CenterOfCell(location));
anim = new Animation("ionsfx");
anim.PlayThen("idle", () => Finish(world));
}
@@ -35,14 +35,14 @@ namespace OpenRA.Mods.Cnc.Effects
public IEnumerable<Renderable> Render()
{
yield return new Renderable(anim.Image,
Traits.Util.CenterOfCell(Target) - new float2(.5f * anim.Image.size.X, anim.Image.size.Y - Game.CellSize),
target.CenterLocation - new float2(.5f * anim.Image.size.X, anim.Image.size.Y - Game.CellSize),
"effect");
}
void Finish( World world )
{
world.AddFrameEndTask(w => w.Remove(this));
Combat.DoExplosion(firedBy, "IonCannon", Target, 0);
Combat.DoExplosion(firedBy, "IonCannon", target, 0);
}
}
}