QueuedActivity's Insert is broken

This commit is contained in:
alzeih
2011-03-18 00:18:57 +13:00
committed by Paul Chote
parent 4e89326134
commit 255bac6aff
64 changed files with 218 additions and 251 deletions

View File

@@ -19,7 +19,7 @@ using System;
namespace OpenRA.Mods.Cnc
{
public class HarvesterDockSequence : IActivity
public class HarvesterDockSequence : Activity
{
enum State
{
@@ -49,9 +49,7 @@ namespace OpenRA.Mods.Cnc
endDock = proc.Trait<IHasLocation>().PxPosition + new int2(-15,8);
}
IActivity NextActivity { get; set; }
public IActivity Tick(Actor self)
public override Activity Tick(Actor self)
{
switch (state)
{
@@ -82,22 +80,15 @@ namespace OpenRA.Mods.Cnc
throw new InvalidOperationException("Invalid harvester dock state");
}
public void Cancel(Actor self)
protected override bool OnCancel(Actor self)
{
state = State.Undock;
return true;
}
public void Queue( IActivity activity )
public override IEnumerable<Target> GetTargetQueue( Actor self )
{
if( NextActivity != null )
NextActivity.Queue( activity );
else
NextActivity = activity;
}
public IEnumerable<float2> GetCurrentPath()
{
yield break;
yield return Target.FromActor(proc);
}
}
}

View File

@@ -116,7 +116,7 @@ namespace OpenRA.Mods.Cnc
}
}
public override IActivity GetAttackActivity(Actor self, Target newTarget, bool allowMove)
public override Activity GetAttackActivity(Actor self, Target newTarget, bool allowMove)
{
return new AttackActivity( newTarget );
}
@@ -137,12 +137,12 @@ namespace OpenRA.Mods.Cnc
return State == PopupState.Closed ? Info.ClosedDamageMultiplier : 1f;
}
class AttackActivity : CancelableActivity
class AttackActivity : Activity
{
readonly Target target;
public AttackActivity( Target newTarget ) { this.target = newTarget; }
public override IActivity Tick( Actor self )
public override Activity Tick( Actor self )
{
if( IsCanceled || !target.IsValid ) return NextActivity;

View File

@@ -27,7 +27,7 @@ namespace OpenRA.Mods.Cnc
public TiberiumRefinery(Actor self, TiberiumRefineryInfo info)
: base(self, info as OreRefineryInfo) {}
public override IActivity DockSequence(Actor harv, Actor self)
public override Activity DockSequence(Actor harv, Actor self)
{
return new HarvesterDockSequence(harv, self);
}