Files
OpenRA/OpenRa.Game/Effects/DelayedAction.cs
2010-01-21 13:27:44 +13:00

27 lines
470 B
C#
Executable File

using System;
using System.Collections.Generic;
using OpenRa.Traits;
namespace OpenRa.Effects
{
public class DelayedAction : IEffect
{
Action a;
int delay;
public DelayedAction(int delay, Action a)
{
this.a = a;
this.delay = delay;
}
public void Tick( World world )
{
if (--delay <= 0)
world.AddFrameEndTask(w => { w.Remove(this); a(); });
}
public IEnumerable<Renderable> Render() { yield break; }
}
}