generalized that hack into something that's probably useful

This commit is contained in:
Chris Forbes
2009-12-28 19:38:21 +13:00
parent 804a21443d
commit a5d450baf8
4 changed files with 31 additions and 36 deletions

View File

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