refactor activity queueing

This commit is contained in:
Bob
2010-09-22 10:13:13 +12:00
parent 271a3eea8d
commit ef665df2e9
37 changed files with 229 additions and 236 deletions

View File

@@ -13,15 +13,15 @@ using OpenRA.Traits;
namespace OpenRA.Mods.RA.Activities
{
class Demolish : IActivity
class Demolish : CancelableActivity
{
Target target;
public IActivity NextActivity { get; set; }
public Demolish( Actor target ) { this.target = Target.FromActor(target); }
public IActivity Tick(Actor self)
{
public override IActivity Tick(Actor self)
{
if( IsCanceled ) return NextActivity;
if (!target.IsValid) return NextActivity;
if ((target.Actor.Location - self.Location).Length > 1)
return NextActivity;
@@ -31,7 +31,5 @@ namespace OpenRA.Mods.RA.Activities
() => { if (target.IsValid) target.Actor.Kill(self); })));
return NextActivity;
}
public void Cancel(Actor self) { target = Target.None; NextActivity = null; }
}
}