Changes name of LaserZap Explosion trait to HitAnim.

Additionally sets default HitAnim to null instead of "laserfire", to avoid crashes when neither a custom HitAnim nor laserfire anim are present.
This commit is contained in:
reaperrr
2013-05-26 16:47:23 +02:00
parent afb67f8595
commit 547e64724f
2 changed files with 11 additions and 10 deletions

View File

@@ -25,7 +25,7 @@ namespace OpenRA.Mods.RA.Effects
public readonly int BeamDuration = 10;
public readonly bool UsePlayerColor = false;
public readonly Color Color = Color.Red;
public readonly string Explosion = "laserfire";
public readonly string HitAnim = null;
public IEffect Create(ProjectileArgs args)
{
@@ -41,7 +41,7 @@ namespace OpenRA.Mods.RA.Effects
int ticks = 0;
Color color;
bool doneDamage;
Animation explosion;
Animation hitanim;
public LaserZap(ProjectileArgs args, LaserZapInfo info, Color color)
{
@@ -49,8 +49,8 @@ namespace OpenRA.Mods.RA.Effects
this.info = info;
this.color = color;
if (info.Explosion != null)
this.explosion = new Animation(info.Explosion);
if (info.HitAnim != null)
this.hitanim = new Animation(info.HitAnim);
}
public void Tick(World world)
@@ -61,16 +61,16 @@ namespace OpenRA.Mods.RA.Effects
if (!doneDamage)
{
if (explosion != null)
explosion.PlayThen("idle",
if (hitanim != null)
hitanim.PlayThen("idle",
() => world.AddFrameEndTask(w => w.Remove(this)));
Combat.DoImpacts(args);
doneDamage = true;
}
++ticks;
if (explosion != null)
explosion.Tick();
if (hitanim != null)
hitanim.Tick();
else
if (ticks >= info.BeamDuration)
world.AddFrameEndTask(w => w.Remove(this));
@@ -78,8 +78,8 @@ namespace OpenRA.Mods.RA.Effects
public IEnumerable<IRenderable> Render(WorldRenderer wr)
{
if (explosion != null)
yield return new SpriteRenderable(explosion.Image, args.dest.ToFloat2(),
if (hitanim != null)
yield return new SpriteRenderable(hitanim.Image, args.dest.ToFloat2(),
wr.Palette("effect"), (int)args.dest.Y);
if (ticks >= info.BeamDuration)

View File

@@ -761,6 +761,7 @@ Laser:
Report: OBELRAY1
Projectile: LaserZap
BeamWidth: 2
HitAnim: laserfire
Warhead:
Spread: 1
Versus: