This commit is contained in:
Matthias Mailänder
2014-05-03 11:32:03 +02:00
parent 0679940c77
commit 8f64835898
11 changed files with 35 additions and 35 deletions

View File

@@ -1,6 +1,6 @@
#region Copyright & License Information
/*
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
* Copyright 2007-2014 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,
@@ -18,23 +18,23 @@ namespace OpenRA.Traits
public Activity NextActivity { get; set; }
protected bool IsCanceled { get; private set; }
public abstract Activity Tick( Actor self );
public abstract Activity Tick(Actor self);
public virtual void Cancel( Actor self )
public virtual void Cancel(Actor self)
{
IsCanceled = true;
NextActivity = null;
}
public virtual void Queue( Activity activity )
public virtual void Queue(Activity activity)
{
if( NextActivity != null )
NextActivity.Queue( activity );
if (NextActivity != null)
NextActivity.Queue(activity);
else
NextActivity = activity;
}
public virtual IEnumerable<Target> GetTargets( Actor self )
public virtual IEnumerable<Target> GetTargets(Actor self)
{
yield break;
}
@@ -42,12 +42,12 @@ namespace OpenRA.Traits
public static class ActivityExts
{
public static IEnumerable<Target> GetTargetQueue( this Actor self )
public static IEnumerable<Target> GetTargetQueue(this Actor self)
{
return self.GetCurrentActivity()
.Iterate( u => u.NextActivity )
.TakeWhile( u => u != null )
.SelectMany( u => u.GetTargets( self ) );
.Iterate(u => u.NextActivity)
.TakeWhile(u => u != null)
.SelectMany(u => u.GetTargets(self));
}
}
}