removing cancelable from Move. remove unnecessary qualified names from Production

This commit is contained in:
Bob
2010-09-22 10:46:54 +12:00
parent ef665df2e9
commit 9e3c938706
2 changed files with 6 additions and 20 deletions

View File

@@ -15,16 +15,13 @@ using System.Linq;
namespace OpenRA.Traits.Activities
{
public class Move : IActivity
public class Move : CancelableActivity
{
IActivity NextActivity { get; set; }
int2? destination;
int nearEnough;
public List<int2> path;
Func<Actor, Mobile, List<int2>> getPath;
public Actor ignoreBuilding;
bool cancellable = true;
int ticksBeforePathing;
@@ -48,7 +45,6 @@ namespace OpenRA.Traits.Activities
.WithoutLaneBias());
this.destination = destination;
this.nearEnough = 0;
this.cancellable = false;
}
public Move( int2 destination, int nearEnough )
@@ -125,7 +121,7 @@ namespace OpenRA.Traits.Activities
return path;
}
public IActivity Tick( Actor self )
public override IActivity Tick( Actor self )
{
var mobile = self.Trait<Mobile>();
@@ -251,20 +247,9 @@ namespace OpenRA.Traits.Activities
return nextCell;
}
public void Cancel( Actor self )
protected override void OnCancel()
{
if (!cancellable) return;
path = new List<int2>();
NextActivity = null;
}
public void Queue( IActivity activity )
{
if( NextActivity != null )
NextActivity.Queue( activity );
else
NextActivity = activity;
}
abstract class MovePart : IActivity

View File

@@ -11,6 +11,7 @@
using System.Drawing;
using OpenRA.FileFormats;
using OpenRA.Traits;
using OpenRA.Traits.Activities;
namespace OpenRA.Mods.RA
{
@@ -61,7 +62,7 @@ namespace OpenRA.Mods.RA
// Animate the spawn -> exit transition
var speed = move.MovementSpeedForCell(self, exit);
var length = speed > 0 ? (int)( ( to - spawn ).Length*3 / speed ) : 0;
newUnit.QueueActivity(new Traits.Activities.Drag(spawn, to, length));
newUnit.QueueActivity(new Drag(spawn, to, length));
// Log.Write("debug", "length={0} facing={1} exit={2} spawn={3}", length, facing.Facing, exit, spawn);
@@ -72,7 +73,7 @@ namespace OpenRA.Mods.RA
{
target = rp.rallyPoint;
// Todo: Move implies unit has Mobile
newUnit.QueueActivity(new Traits.Activities.Move(target, 1));
newUnit.QueueActivity(new Move(target, 1));
}
if (newUnit.Owner == self.World.LocalPlayer)