invuln moved to mod

This commit is contained in:
Chris Forbes
2010-01-29 19:48:51 +13:00
parent 84d2a01a69
commit d043f6690d
8 changed files with 23 additions and 17 deletions

View File

@@ -0,0 +1,31 @@
using System.Collections.Generic;
using OpenRa.Graphics;
using OpenRa.Traits;
using OpenRa.Effects;
namespace OpenRa.Mods.RA.Effects
{
class InvulnEffect : IEffect
{
Actor a;
IronCurtainable b;
public InvulnEffect(Actor a)
{
this.a = a;
this.b = a.traits.Get<IronCurtainable>();
}
public void Tick( World world )
{
if (a.IsDead || b.GetDamageModifier() > 0)
world.AddFrameEndTask(w => w.Remove(this));
}
public IEnumerable<Renderable> Render()
{
foreach (var r in a.Render())
yield return r.WithPalette(PaletteType.Invuln);
}
}
}