Files
OpenRA/OpenRA.Game/Traits/Activities/RemoveSelf.cs
2010-07-18 16:48:21 +12:00

28 lines
751 B
C#

#region Copyright & License Information
/*
* Copyright 2007-2010 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see LICENSE.
*/
#endregion
namespace OpenRA.Traits.Activities
{
public class RemoveSelf : IActivity
{
bool isCanceled;
public IActivity NextActivity { get; set; }
public IActivity Tick(Actor self)
{
if (isCanceled) return NextActivity;
self.World.AddFrameEndTask(w => w.Remove(self));
return null;
}
public void Cancel(Actor self) { isCanceled = true; NextActivity = null; }
}
}